feat: 初始化仓库
This commit is contained in:
79
schemas/file.py
Normal file
79
schemas/file.py
Normal file
@@ -0,0 +1,79 @@
|
||||
# _*_ coding : UTF-8 _*_
|
||||
# @Time : 2025/01/26 01:15
|
||||
# @UpdateTime : 2025/01/26 01:15
|
||||
# @Author : sonder
|
||||
# @File : file.py
|
||||
# @Software : PyCharm
|
||||
# @Comment : 本程序
|
||||
|
||||
from typing import Optional, List
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from schemas.common import BaseResponse, ListQueryResult
|
||||
|
||||
|
||||
class FileInfo(BaseModel):
|
||||
"""
|
||||
文件信息
|
||||
"""
|
||||
id: str = Field(..., title="文件id")
|
||||
name: str = Field(..., title="文件名")
|
||||
size: int = Field(..., title="文件大小")
|
||||
file_type: str = Field(..., title="文件类型")
|
||||
absolute_path: str = Field(..., title="绝对路径")
|
||||
relative_path: str = Field(..., title="相对路径")
|
||||
uploader_id: Optional[str] = Field(..., title="上传者ID")
|
||||
uploader_username: Optional[str] = Field(..., title="上传者用户名")
|
||||
uploader_nickname: Optional[str] = Field(..., title="上传者昵称")
|
||||
uploader_department_id: Optional[str] = Field(..., title="上传者部门ID")
|
||||
uploader_department_name: Optional[str] = Field(..., title="上传者部门名称")
|
||||
update_time: str = Field(..., title="更新时间")
|
||||
create_time: str = Field(..., title="创建时间")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"id": "1",
|
||||
"name": "test.txt",
|
||||
"size": 1024,
|
||||
"file_type": "text/plain",
|
||||
"absolute_path": "/home/test.txt",
|
||||
"relative_path": "/test.txt",
|
||||
"uploader_id": "1",
|
||||
"uploader_username": "test",
|
||||
"uploader_nickname": "test",
|
||||
"uploader_department_id": "1",
|
||||
"uploader_department_name": "test",
|
||||
"update_time": "2025-01-26 01:15:00",
|
||||
"create_time": "2025-01-26 01:15:00"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class UploadFileResponse(BaseResponse):
|
||||
"""
|
||||
上传文件响应模型
|
||||
"""
|
||||
data: FileInfo = Field(..., title="文件信息")
|
||||
|
||||
|
||||
class GetFileInfoResponse(BaseResponse):
|
||||
"""
|
||||
获取文件响应模型
|
||||
"""
|
||||
data: FileInfo = Field(..., title="文件信息")
|
||||
|
||||
|
||||
class GetFileListResult(ListQueryResult):
|
||||
"""
|
||||
获取文件列表结果模型
|
||||
"""
|
||||
result: List[FileInfo] = Field(..., title="文件列表")
|
||||
|
||||
|
||||
class GetFileListResponse(BaseResponse):
|
||||
"""
|
||||
获取文件列表响应模型
|
||||
"""
|
||||
data: GetFileListResult = Field(..., title="文件列表结果")
|
||||
Reference in New Issue
Block a user