dingdanquanliucheng/backend/app/schemas/files.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

51 lines
1.2 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.

"""
文件上传模块请求模型
定义文件上传相关的请求体数据模型,供 files 路由使用。
包含获取上传凭证和保存附件元信息两个操作。
"""
from pydantic import BaseModel, Field
class CreateUploadTokenRequest(BaseModel):
"""获取文件上传凭证请求体。被 POST /api/files/upload-token 路由使用。"""
biz_type: str
"""业务类型(如 order / logistics / customer 等,用于文件归档分类)"""
biz_id: int = Field(gt=0)
"""业务关联 ID如订单 ID、客户 ID 等)"""
file_name: str
"""原始文件名称"""
file_type: str
"""文件 MIME 类型(如 image/png"""
file_size: int = Field(gt=0)
"""文件大小(字节)"""
class SaveAttachmentRequest(BaseModel):
"""保存附件元信息请求体。被 POST /api/files/attachments 路由使用。"""
biz_type: str
"""业务类型"""
biz_id: int = Field(gt=0)
"""业务关联 ID"""
file_name: str
"""文件名称"""
file_url: str
"""文件 URL上传后的访问地址"""
file_type: str
"""文件 MIME 类型"""
file_size: int = Field(gt=0)
"""文件大小(字节)"""