25 lines
529 B
Python
25 lines
529 B
Python
"""用户 Schemas — 对接 MOM sys_user 表"""
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
username: str = Field(..., max_length=64)
|
|
password: str = Field(..., max_length=128)
|
|
|
|
|
|
class UserResponse(BaseModel):
|
|
id: str
|
|
username: str
|
|
display_name: str
|
|
role: str
|
|
is_active: bool = True
|
|
created_at: str | None = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class LoginResponse(BaseModel):
|
|
access_token: str
|
|
token_type: str = "bearer"
|
|
user: UserResponse
|