7f7da15965
Completed: - Phase 0: Project Setup (T001-T003) - Docker Compose, FastAPI skeleton, React SPA - Phase 1: Auth System (T004-T008) - DB models, JWT auth, RBAC middleware, user management - Phase 2: Contacts & Tags (T009-T011) - CRUD API + UI - Phase 3: Equipment Catalog (T012-T014) - Models, API, UI with barcode/QR - Phase 4: Crew Management (T015-T017) - Models, availability, UI - Phase 5: Vehicle Fleet (T018-T020) - Models, assignments, UI - Phase 6: Projects (T021-T023) - Project hierarchy models, CRUD API, list/detail UI
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
"""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
|