✨ feat(core): 引入垃圾回收管理功能
* 新增垃圾回收管理逻辑,支持批量管理与清理功能 * 在数据模型中增加过期时间与保留天数验证逻辑 * 在 FileService 中集成垃圾回收管理模块 * 调整任务调度逻辑以适配新的垃圾回收规则 * 为垃圾回收功能补充相应的单元测试覆盖
This commit is contained in:
1 parent
356f23bae1
commit
b10113e5ab
6 files changed
+388
-46
No files matched your search
+14
-2
@@ -22,6 +22,7 @@ from apps.admin.schemas import (
|
||||
BatchFilePolicyActionData,
|
||||
FilePolicyActionData,
|
||||
TrashRetentionData,
|
||||
BatchTrashData,
|
||||
FileMetadataData,
|
||||
FileViewPresetData,
|
||||
FileViewPresetDeleteData,
|
||||
@@ -459,9 +460,20 @@ async def file_batch_delete_post(
|
||||
async def trash_list(
|
||||
page: int = 1,
|
||||
size: int = 20,
|
||||
keyword: str = "",
|
||||
state: str = "all",
|
||||
reason: str = "",
|
||||
file_service: FileService = Depends(get_file_service),
|
||||
):
|
||||
return APIResponse(detail=await file_service.list_trash(page, size))
|
||||
return APIResponse(detail=await file_service.list_trash(page, size, keyword, state, reason))
|
||||
|
||||
|
||||
@admin_api.post("/trash/batch")
|
||||
async def trash_batch(
|
||||
data: BatchTrashData,
|
||||
file_service: FileService = Depends(get_file_service),
|
||||
):
|
||||
return APIResponse(detail=await file_service.batch_trash(data.ids, data.action, data.retentionDays, data.expiresAt))
|
||||
|
||||
|
||||
@admin_api.post("/trash/restore")
|
||||
@@ -478,7 +490,7 @@ async def trash_retention(
|
||||
data: TrashRetentionData,
|
||||
file_service: FileService = Depends(get_file_service),
|
||||
):
|
||||
file_code = await file_service.set_trash_retention(data.id, data.retentionDays)
|
||||
file_code = await file_service.set_trash_retention(data.id, data.retentionDays, data.expiresAt)
|
||||
return APIResponse(detail={"id": file_code.id, "trashExpiresAt": file_code.trash_expires_at})
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user