6c86f0f571
- integrated request-module into module registry - moved backend into modules/request-module - added manifest.json and module.py - implemented dynamic router mounting - implemented dynamic static mounting - removed direct dependencies from platform core - verified startup with request-module - verified startup without request-module - added implementation_report_003.md
62 lines
1.4 KiB
Python
62 lines
1.4 KiB
Python
"""User schemas."""
|
|
|
|
from pydantic import BaseModel, EmailStr, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
from request_app.schemas.common import PaginationParams
|
|
|
|
|
|
class UserCreate(BaseModel):
|
|
"""User creation schema."""
|
|
|
|
email: EmailStr
|
|
password: str = Field(..., min_length=6)
|
|
first_name: str = Field(..., min_length=1, max_length=100)
|
|
last_name: str = Field(..., min_length=1, max_length=100)
|
|
phone: Optional[str] = None
|
|
role_id: Optional[int] = None
|
|
|
|
|
|
class UserUpdate(BaseModel):
|
|
"""User update schema."""
|
|
|
|
first_name: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
last_name: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
email: Optional[str] = None
|
|
phone: Optional[str] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class UserResponse(BaseModel):
|
|
"""User response schema."""
|
|
|
|
id: int
|
|
first_name: str
|
|
last_name: str
|
|
email: str
|
|
phone: Optional[str]
|
|
is_active: bool
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
roles: list[str] = []
|
|
departments: list[str] = []
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class UserListResponse(BaseModel):
|
|
"""User list response schema."""
|
|
|
|
users: list[UserResponse]
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
total_pages: int
|
|
|
|
|
|
class UserWithRoles(UserResponse):
|
|
"""User with roles response schema."""
|
|
|
|
role_ids: list[int] = []
|