add User return schema

This commit is contained in:
IluaAir
2025-07-13 11:41:58 +03:00
parent d27aafb4f6
commit f3030593da
12 changed files with 102 additions and 64 deletions

View File

@@ -6,11 +6,12 @@ from src.schemas.validators import ensure_password
class User(BaseModel):
id: int
email: EmailStr | None
username: str
is_active: bool
is_superuser: bool
model_config = ConfigDict(from_attributes=True)
model_config = ConfigDict(from_attributes=True, extra="ignore")
class UserWithHashedPass(User):
@@ -21,3 +22,11 @@ class UserRequest(BaseModel):
username: str
email: EmailStr | None = None
password: Annotated[str, BeforeValidator(ensure_password)]
class UserAdd(BaseModel):
email: EmailStr | None
username: str
is_active: bool
is_superuser: bool
hashed_password: str