Includes atomic migrations, per-rule reminder semantics, first-run helper script and the note on the undecided UI chat idea. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
23 lines
800 B
Python
23 lines
800 B
Python
import asyncio
|
|
|
|
from fastapi import APIRouter, Depends, Request
|
|
from fastapi.responses import JSONResponse
|
|
|
|
from .. import audit
|
|
from ..users import User
|
|
from .alerting_section import BASELINE_PATH
|
|
from .deps import require_admin
|
|
|
|
router = APIRouter()
|
|
|
|
AUDIT_ACTION = "baseline.request"
|
|
MSG_REQUESTED = ("Baseline angefordert: Der nächste erfolgreiche Abruf zeichnet den Zustand still auf und "
|
|
"sendet eine Zusammenfassung.")
|
|
|
|
|
|
@router.post(BASELINE_PATH)
|
|
async def request_baseline(request: Request, admin: User = Depends(require_admin)):
|
|
await asyncio.to_thread(request.app.state.runtime.baseline.request)
|
|
await asyncio.to_thread(audit.record, request.app.state.db, admin.username, AUDIT_ACTION, "baseline")
|
|
return JSONResponse({"ok": True, "detail": MSG_REQUESTED})
|