init: 从 /root/zikai 根目录迁入
把原本散落在 /root/zikai 的 FastAPI 服务整理到 server/ 子目录, 开启独立 git 与 venv。运行时数据(config.yaml / keys / uploads) 按 .gitignore 留在工作目录但不入仓。
This commit is contained in:
35
app/schemas/file.py
Normal file
35
app/schemas/file.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""文件接口 DTO。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class UploadedFileOut(BaseModel):
|
||||
id: int
|
||||
storage_path: str
|
||||
original_filename: str
|
||||
content_type: str
|
||||
size_bytes: int
|
||||
sha256: str
|
||||
source: str
|
||||
uploaded_by: str
|
||||
uploaded_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class FileUploadResponse(BaseModel):
|
||||
id: int = Field(..., description="新写入的数据库行 ID")
|
||||
filename: str = Field(..., description="客户端原始文件名")
|
||||
size_bytes: int
|
||||
sha256: str
|
||||
storage_path: str
|
||||
uploaded_at: datetime
|
||||
|
||||
|
||||
class FileListResponse(BaseModel):
|
||||
total: int
|
||||
items: list[UploadedFileOut]
|
||||
Reference in New Issue
Block a user