All checks were successful
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 23s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 24s
- Implemented media lifecycle management with new API endpoints for handling asset states (trash_soft, trash_hidden, recover, purge), improving media governance. - Updated frontend components to filter and display media based on lifecycle states, enhancing user experience and visibility. - Enhanced documentation in MEDIA_ASSETS_AND_ARCHIVE_SPEC.md to include guidelines for inline media references in exercise texts, establishing a clear implementation plan. - Incremented version to 0.8.42, reflecting the latest changes in media handling and lifecycle management.
36 lines
902 B
Python
36 lines
902 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Automatische Medien-Retention (Papierkorb Stufe 1→2, Purge wenn fällig).
|
|
|
|
Lauf z. B. täglich per Cron:
|
|
cd /path/to/backend && python scripts/media_retention_job.py
|
|
|
|
Umgebung wie Backend (DB_*), optional:
|
|
MEDIA_TRASH_SOFT_TO_HIDDEN_DAYS (Default 30)
|
|
MEDIA_TRASH_HIDDEN_TO_PURGE_DAYS (Default 90)
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
# Repo-Root: backend/scripts -> parents[1] == backend
|
|
_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
|
if _ROOT not in sys.path:
|
|
sys.path.insert(0, _ROOT)
|
|
|
|
from db import get_db, get_cursor # noqa: E402
|
|
from media_lifecycle import run_retention_pass # noqa: E402
|
|
|
|
|
|
def main() -> int:
|
|
with get_db() as conn:
|
|
cur = get_cursor(conn)
|
|
summary = run_retention_pass(cur, conn)
|
|
print(summary)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|