"""Pydantic schemas - 用户认证""" from pydantic import BaseModel, Field from typing import Optional from datetime import datetime class LoginRequest(BaseModel): """登录请求""" username: str = Field(..., min_length=3, max_length=50) password: str = Field(..., min_length=6) class LoginResponse(BaseModel): """登录响应""" access_token: str token_type: str = "bearer" user_id: int username: str role: str real_name: Optional[str] = None class UserCreate(BaseModel): """创建用户请求""" username: str = Field(..., min_length=3, max_length=50) password: str = Field(..., min_length=6) real_name: Optional[str] = None phone: Optional[str] = None role: str region_id: Optional[int] = None class UserResponse(BaseModel): """用户响应""" id: int username: str real_name: Optional[str] = None phone: Optional[str] = None role: str region_id: Optional[int] = None is_active: bool created_at: datetime class Config: from_attributes = True class ChangePasswordRequest(BaseModel): """修改密码请求""" old_password: str new_password: str = Field(..., min_length=6) class ResetPasswordRequest(BaseModel): """重置密码请求(运营操作)""" user_id: int