feat: sync status indicator, admin pause/resume, filtered video count

- Header shows a live sync status (total videos + channels still backfilling, or
  "paused"), polled every 30s
- Admins can pause/resume the background sync; a paused flag in app_state makes
  scheduled jobs skip (migration 0006)
- GET /api/feed/count returns the number of videos matching the current filters;
  shared filter builder keeps it in sync with /api/feed; shown above the feed
- /api/sync/status reports backfill progress, pending enrichment and paused state
This commit is contained in:
npeter83 2026-06-11 04:15:25 +02:00
parent f73cbdb490
commit dc73b43b71
10 changed files with 298 additions and 69 deletions

24
backend/app/state.py Normal file
View file

@ -0,0 +1,24 @@
"""Global admin-controlled app state (e.g. pausing background sync)."""
from sqlalchemy.orm import Session
from app.models import AppState
def _row(db: Session) -> AppState:
row = db.get(AppState, 1)
if row is None:
row = AppState(id=1, sync_paused=False)
db.add(row)
db.commit()
return row
def is_sync_paused(db: Session) -> bool:
return _row(db).sync_paused
def set_sync_paused(db: Session, paused: bool) -> None:
row = _row(db)
row.sync_paused = paused
db.add(row)
db.commit()