feat(integrity): /trigger accepts mode=verify → enqueues verify_integrity

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 17:51:56 -04:00
parent e28de547c7
commit 389d1bb0cf
2 changed files with 33 additions and 3 deletions
+10 -3
View File
@@ -15,10 +15,17 @@ import_admin_bp = Blueprint("import_admin", __name__, url_prefix="/api/import")
async def trigger_scan():
body = await request.get_json(silent=True) or {}
mode = body.get("mode", "quick")
if mode not in ("quick", "deep"):
return jsonify({"error": f"mode {mode!r} not supported; use 'quick' or 'deep'"}), 400
if mode not in ("quick", "deep", "verify"):
return jsonify({"error": f"mode {mode!r} not supported; use 'quick', 'deep', or 'verify'"}), 400
# 'verify' is a library task — short-circuit the import_root walk
# (no ImportBatch, no per-file ImportTasks).
if mode == "verify":
from ..tasks.maintenance import verify_integrity
async_result = verify_integrity.delay()
return jsonify({"celery_task_id": async_result.id, "mode": mode}), 202
# Enqueue the scan task in Celery. The task creates the batch itself.
from ..tasks.scan import scan_directory
async_result = scan_directory.delay(triggered_by="manual", mode=mode)