26 lines
562 B
Python

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