e7fba5abe5
- fix(storage): StorageOut 增加 config 字段并解密返回,编辑时可回填
- fix(storage): Storage ORM 模型添加 config property 支持序列化
- fix(env): 修正 SECRET_KEY 截断、FERNET_KEY 非法占位符问题
- fix(deploy): 后端从 Docker 容器迁移到 systemd 服务,存储目标路径改为宿主机真实路径
- feat(api): 新增 GET /api/storages/{id}/files 文件浏览端点
- feat(frontend): 新增 listFiles API 调用
- docs: 更新 README 反映部署方式变更
52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
from datetime import datetime
|
|
from typing import Literal, Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class LocalStorageConfig(BaseModel):
|
|
path: str = Field(..., min_length=1, description="本地存储根目录绝对路径")
|
|
|
|
|
|
class S3StorageConfig(BaseModel):
|
|
endpoint_url: Optional[str] = Field(None, description="MinIO/Ceph 自定义 endpoint,留空使用 AWS")
|
|
region: str = Field("us-east-1")
|
|
bucket: str = Field(..., min_length=1)
|
|
access_key: str = Field(..., min_length=1)
|
|
secret_key: str = Field(..., min_length=1)
|
|
use_ssl: bool = True
|
|
path_prefix: str = Field("", description="对象 key 前缀,可空")
|
|
addressing_style: Literal["auto", "path", "virtual"] = "auto"
|
|
|
|
|
|
class StorageBase(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=64)
|
|
type: Literal["local", "s3"]
|
|
is_default: bool = False
|
|
|
|
|
|
class StorageCreate(StorageBase):
|
|
config: dict
|
|
|
|
|
|
class StorageUpdate(BaseModel):
|
|
name: Optional[str] = Field(None, min_length=1, max_length=64)
|
|
is_default: Optional[bool] = None
|
|
config: Optional[dict] = None
|
|
|
|
|
|
class StorageOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
name: str
|
|
type: str
|
|
is_default: bool
|
|
config: dict
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class StorageTestResponse(BaseModel):
|
|
ok: bool
|
|
message: str
|