from pydantic import BaseModel, EmailStr from pydantic_mongo import AbstractRepository, ObjectIdField from datetime import datetime, date class User(BaseModel): id: ObjectIdField = None username: str password: str firstName: str = "" name: str = "" roles: str = "User" status: int = 0 email: EmailStr birth: str | None = None created_at: datetime = datetime.today() connected_at: datetime | None = None updated_at: datetime = datetime.today() deleted_at: datetime | None = None class UserOut(BaseModel): id: ObjectIdField = None username: str roles: str firstName: str name: str status: int = 0 email: EmailStr class UserIn(BaseModel): username: str name: str firstName: str roles: str password: str birth: 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"