Files
LoveACE-EndF/loveace/service/remote/s3/model/s3.py
Sibuxiangx bbc86b8330 ⚒️ 重大重构 LoveACE V2
引入了 mongodb
对数据库进行了一定程度的数据加密
性能改善
代码简化
统一错误模型和响应
使用 apifox 作为文档
2025-11-20 20:44:25 +08:00

60 lines
1.4 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.

from typing import Optional
from pydantic import BaseModel
class S3UploadResult(BaseModel):
"""S3 上传结果"""
success: bool
"""上传是否成功"""
url: Optional[str] = None
"""直链 URL仅在上传成功时返回"""
key: Optional[str] = None
"""S3 对象键"""
error: Optional[str] = None
"""错误信息,仅在上传失败时返回"""
class S3CopyResult(BaseModel):
"""S3 复制结果"""
success: bool
"""复制是否成功"""
source_key: Optional[str] = None
"""源 S3 对象键"""
dest_key: Optional[str] = None
"""目标 S3 对象键"""
dest_url: Optional[str] = None
"""目标直链 URL仅在复制成功时返回"""
error: Optional[str] = None
"""错误信息,仅在复制失败时返回"""
class S3Object(BaseModel):
"""S3 对象基本信息"""
key: str
"""对象键"""
size: int
"""对象大小(字节)"""
last_modified: str
"""最后修改时间"""
class S3ListResult(BaseModel):
"""S3 列表操作结果"""
success: bool
"""操作是否成功"""
objects: list[S3Object] = []
"""对象列表"""
prefix: str = ""
"""前缀"""
is_truncated: bool = False
"""是否存在更多对象"""
continuation_token: Optional[str] = None
"""继续令牌,用于分页"""
error: Optional[str] = None
"""错误信息"""