feat: add storage cleanup mechanism with soft delete and auto scheduler

- Add soft delete (deleted_at column) to preserve task records for statistics
- Implement cleanup service to delete old files while keeping DB records
- Add automatic cleanup scheduler (configurable interval, default 24h)
- Add admin endpoints: storage stats, cleanup trigger, scheduler status
- Update task service with admin views (include deleted/files_deleted)
- Add frontend storage management UI in admin dashboard
- Add i18n translations for storage management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-14 12:41:01 +08:00
parent 81a0a3ab0f
commit 73112db055
23 changed files with 1359 additions and 634 deletions

View File

@@ -55,6 +55,11 @@ class Settings(BaseSettings):
task_retention_days: int = Field(default=30)
max_tasks_per_user: int = Field(default=1000)
# ===== Storage Cleanup Configuration =====
cleanup_enabled: bool = Field(default=True, description="Enable automatic file cleanup")
cleanup_interval_hours: int = Field(default=24, description="Hours between cleanup runs")
max_files_per_user: int = Field(default=50, description="Max task files to keep per user")
# ===== OCR Configuration =====
# Note: PaddleOCR models are stored in ~/.paddleocr/ and ~/.paddlex/ by default
ocr_languages: str = Field(default="ch,en,japan,korean")