2023-10-14 23:04:19 +02:00

42 lines
807 B
Python

from pydantic import BaseModel, EmailStr
from pydantic_mongo import AbstractRepository, ObjectIdField
class User(BaseModel):
id: ObjectIdField = None
username: str
password: str
roles: str = "User"
disabled: bool = False
removed: bool = False
confirmed: bool = False
email: EmailStr
class UserOut(BaseModel):
id: ObjectIdField = None
username: str
roles: str
disabled: bool
removed: bool
confirmed: bool
email: EmailStr
class UserIn(BaseModel):
username: str
roles: str
password: str
email: EmailStr
class UserCreate(BaseModel):
username: str
password: str
email: EmailStr
class UserInDB(User):
password: str
class UserRepository(AbstractRepository[User]):
class Meta:
collection_name = "users"