finai/backend/app/schemas/auth.py

30 lines
643 B
Python

from pydantic import BaseModel, Field
class SmsCodeRequest(BaseModel):
phone: str = Field(min_length=6, max_length=32)
class LoginRequest(BaseModel):
phone: str = Field(min_length=6, max_length=32)
code: str = Field(min_length=4, max_length=8)
class CurrentUserResponse(BaseModel):
id: int
phone: str
name: str
department: str | None = None
unit_id: int | None = None
unit_name: str | None = None
status: str
roles: list[str]
permissions: list[str]
is_superuser: bool
class TokenResponse(BaseModel):
access_token: str
token_type: str = "bearer"
user: CurrentUserResponse