Files
Catubba 5dc8c5719a feat(api): per-route scheduler, route/device REST API and notifications
Wire the route model to the outside world and retire the 0.9 single-PVE/PBS one.

Scheduler: one cron job per enabled route (route:<id>), built from schedule.time +
days or the schedule.cron escape hatch, gated by the new app.scheduler_enabled
kill-switch. Missed-run detection is per route.

API: new /api/routes and /api/devices (CRUD, connection test, power, ad-hoc GC and
verify), with a 409 removal guard that names the routes still using a device.
Status, dashboard and metrics report one entry per route and per PBS; metrics keep
their joulenap_ names and gain route=/pbs= labels. Cancel moved to
POST /api/runs/{id}/stop, /api/guests is scoped to one PVE, and the WoL smoke test
moved into the wizard router.

Notifications: the positional 5-tuple becomes a RunContext, filtered per route.
Cycles now return that context instead of sending it; the job service sends it after
releasing the power leases, so the message can report whether the box went back to
sleep, and the wake/power-off steps are recorded in the run's timeline again.

Removes pve:/pbs:/backup:/maintenance.gc/maintenance.verify from the schema (old
files still load: the keys are stripped after the 1.0 migration runs), the 0.9
cycles and job entry points, and the config-shaped connector factories.

Also fixes redacted secrets being matched by list position rather than by device id,
and git-ignores the migration's rollback copy of config.yaml, which holds the same
tokens as the original.
2026-08-02 20:33:41 +02:00

38 lines
951 B
Python

"""Aggregate API router: auth, the route/device CRUD the UI is built on, the
status/dashboard/logs read models, and the setup-wizard helpers."""
from fastapi import APIRouter
from . import (
auth,
config,
dashboard,
devices,
guests,
jobs,
logs,
notify,
routes,
scheduler,
status,
update,
wizard,
)
api_router = APIRouter(prefix="/api")
api_router.include_router(auth.router)
api_router.include_router(status.router)
api_router.include_router(dashboard.router)
api_router.include_router(config.router)
api_router.include_router(routes.router)
api_router.include_router(devices.router)
api_router.include_router(guests.router)
api_router.include_router(scheduler.router)
api_router.include_router(jobs.router)
api_router.include_router(notify.router)
api_router.include_router(logs.router)
api_router.include_router(wizard.router)
api_router.include_router(update.router)
__all__ = ["api_router"]