Files
rentman-clone/backend/app/schemas/user.py
T

45 lines
1.0 KiB
Python
Raw Normal View History

"""Pydantic schemas for user management."""
from pydantic import BaseModel, EmailStr, Field
class UserCreateRequest(BaseModel):
"""Request body for creating a new user (invite)."""
email: EmailStr
full_name: str = Field(..., min_length=2, max_length=255)
password: str = Field(..., min_length=8, max_length=128)
role_id: str | None = None
class UserUpdateRequest(BaseModel):
"""Request body for updating an existing user."""
full_name: str | None = Field(None, min_length=2, max_length=255)
role_id: str | None = None
is_active: bool | None = None
class UserResponse(BaseModel):
"""Public user representation (no password hash)."""
id: str
account_id: str
email: str
full_name: str
is_active: bool
role_id: str | None = None
created_at: str
updated_at: str
model_config = {"from_attributes": True}
class UserListResponse(BaseModel):
"""Paginated list of users."""
items: list[UserResponse]
total: int
page: int
size: int