siftlode/backend/app/routes
npeter83 318fdc4812 feat(audit): admin audit log (Notification P3)
Append-only who/what/when trail for admin actions + scheduler run summaries,
generalizing QuotaEvent. Logged at ACTION / run-summary granularity — never
per-row (a scheduler run touching thousands of videos is ONE row).

Backend:
- migration 0054_audit_log + AuditLog model (actor_id FK SET NULL, action,
  target_type/id, summary, before/after JSON, created_at).
- app/audit.py: AuditAction constants (single source of truth, i18n'd on the
  client) + record() (adds to the caller's txn) + gc(retention_days).
- producers wired: role change / suspend / delete / invite approve-deny-add /
  demo add-remove-reset / discovery purge (admin.py); config set/reset — secret
  VALUES never logged, key only (config.py); scheduler interval + maintenance
  tune (scheduler routes); sync pause/resume (sync.py); and the scheduler _job()
  choke point writes ONE run-summary row per run — manual runs + errors always,
  automatic runs only when they changed something (no no-op-poll spam).
- retention: audit_gc scheduler job prunes rows older than audit_retention_days
  (sysconfig, default 180; 0 = keep forever).
- admin API routes/audit.py (/api/admin/audit): recent-window list (actor emails
  resolved, System for background) + clear (leaves one tamper-evidence row).

Frontend:
- new admin-only "Audit log" nav page (ScrollText) using the shared DataTable
  (first admin page to reuse it) — sort/filter/paginate/persist, action select
  filter, actor text filter, before→after detail, Clear-all with confirm.
- AuditLog.tsx + auditColumns.tsx + api.adminAudit/clearAudit + AuditRow type.
- trilingual audit + auditActions namespaces (HU/EN/DE) + nav + config-group +
  scheduler job labels; Audit config group (retention days).
2026-07-12 07:32:41 +02:00
..
__init__.py feat: M1 foundation — compose stack, FastAPI, Google OAuth, encrypted tokens 2026-06-11 01:01:37 +02:00
admin.py feat(audit): admin audit log (Notification P3) 2026-07-12 07:32:41 +02:00
audit.py feat(audit): admin audit log (Notification P3) 2026-07-12 07:32:41 +02:00
channels.py fix(deferred): address /code-review findings on the closeout diff 2026-07-12 06:21:29 +02:00
config.py feat(audit): admin audit log (Notification P3) 2026-07-12 07:32:41 +02:00
downloads.py fix(deferred): close backend correctness/efficiency tails from the hygiene sweep 2026-07-12 05:59:03 +02:00
feed.py chore(feed): Phase 2 #2 backend cleanup — dead return, dup helpers, shared const 2026-07-11 17:37:52 +02:00
health.py feat: M1 foundation — compose stack, FastAPI, Google OAuth, encrypted tokens 2026-06-11 01:01:37 +02:00
me.py fix(auth): security hardening — token encryption, timing, adoption + isolation 2026-07-11 21:26:39 +02:00
messages.py fix(deferred): address /code-review findings on the closeout diff 2026-07-12 06:21:29 +02:00
notifications.py feat(notifications): durable per-user inbox (P1) + maintenance schema 2026-06-18 03:20:17 +02:00
playlists.py fix(deferred): close backend correctness/efficiency tails from the hygiene sweep 2026-07-12 05:59:03 +02:00
plex.py chore(hygiene): Phase 4 guardrails — noUnusedLocals/Parameters + dead-code sweep 2026-07-12 02:15:52 +02:00
public.py chore(downloads): C3-C6 — DRY the source-URL, filename, and serialize helpers 2026-07-11 05:47:51 +02:00
quota.py feat(stats): per-user API quota attribution + admin usage page 2026-06-12 02:47:55 +02:00
saved_views.py feat(views): saved-views backend — table, model, CRUD + reorder API 2026-07-01 03:17:36 +02:00
scheduler.py feat(audit): admin audit log (Notification P3) 2026-07-12 07:32:41 +02:00
search.py fix(deferred): close backend correctness/efficiency tails from the hygiene sweep 2026-07-12 05:59:03 +02:00
setup.py feat(setup): install-wizard step endpoints (epic 6c, API) 2026-06-21 00:40:54 +02:00
sync.py feat(audit): admin audit log (Notification P3) 2026-07-12 07:32:41 +02:00
tags.py refactor(auth): centralize token hashing, email validation & admin gating 2026-06-26 03:15:36 +02:00
version.py feat(version): /api/version + build-time version/commit stamping 2026-06-15 00:06:57 +02:00