dingdanquanliucheng/backend/app/schemas/auth.py
taiyi 9b32afdbb4 为后端全部 86 个 Python 文件添加中文注释
覆盖所有模块:
- api 层:17 个路由文件,每个接口标注用途、参数、返回值、权限
- services 层:18 个服务文件,每个方法标注作用、参数、返回值、调用方
- repositories 层:13 个仓储文件,每个方法标注查询逻辑和被调用方
- schemas 层:11 个请求/响应体文件,每个字段标注业务含义
- core 层:config、security、exceptions、responses、error_codes
- models 层:19 个 ORM 模型类,每个表标注业务含义和关联关系
- scripts:bootstrap_data、smoke_check
- migrations:env.py 和版本迁移文件

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 07:23:33 +08:00

55 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
认证模块请求/响应模型
定义登录认证相关的请求体和响应体数据模型,供 auth 路由使用。
"""
from pydantic import BaseModel
class LoginRequest(BaseModel):
"""登录请求体,用于用户登录认证。被 POST /api/auth/login 路由使用。"""
username: str
"""用户名"""
password: str
"""密码"""
role_type: str
"""角色类型,区分不同登录角色(如 admin / sales"""
class UserProfile(BaseModel):
"""用户信息响应体,包含用户基本信息、角色权限和菜单数据。用于登录成功后返回用户画像。"""
user_id: int
"""用户 ID"""
username: str
"""用户名"""
real_name: str
"""真实姓名"""
mobile: str
"""手机号"""
role_id: int
"""角色 ID"""
role_name: str
"""角色名称"""
role_code: str
"""角色编码"""
token: str | None = None
"""JWT 令牌,仅登录时返回"""
menus: list[dict] = []
"""该角色关联的菜单列表"""
permissions: list[str] = []
"""该角色的权限编码列表"""