feat(scheduler): admin-editable job intervals (DB-backed, live reschedule)

Add scheduler_settings (per-job interval override, migration 0015) and a
PATCH /api/admin/scheduler/jobs/{id} that persists the override and live-
reschedules the running APScheduler job. Intervals load from the DB (env
defaults as fallback); the snapshot reports the live trigger interval.
This commit is contained in:
npeter83 2026-06-16 15:58:23 +02:00
parent b71d07c098
commit 84aebe16c7
4 changed files with 126 additions and 41 deletions

View file

@ -325,6 +325,17 @@ class AppState(Base):
)
class SchedulerSetting(Base):
"""Admin override for a scheduler job's run interval (minutes). One row per job id;
absent = use the env/config default. DB-backed so it's editable from the admin UI at
runtime without a redeploy (env stays a fallback)."""
__tablename__ = "scheduler_settings"
job_id: Mapped[str] = mapped_column(String(40), primary_key=True)
interval_minutes: Mapped[int] = mapped_column(Integer)
class Playlist(Base):
"""A per-user named, ordered collection of videos from the shared catalog.