feat: add calibration sync system.

This commit is contained in:
2026-06-04 18:52:22 +00:00
parent 56bd3041cf
commit 6c41ccf1bd
4 changed files with 388 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
"""
Calibration Sync Router
Endpoints for triggering and inspecting the SFM-driven calibration sync.
The scheduled job runs daily; this router is what the "Sync now" button in
Settings calls, plus a status endpoint for diagnostics.
"""
from fastapi import APIRouter
from typing import Dict, Any
from backend.services.calibration_sync import (
sync_all_calibrations,
get_calibration_sync_scheduler,
)
router = APIRouter(prefix="/api/calibration", tags=["calibration"])
@router.post("/sync")
async def trigger_calibration_sync() -> Dict[str, Any]:
"""Run a full calibration sync now and return the summary."""
summary = await sync_all_calibrations()
get_calibration_sync_scheduler().last_run = summary
return summary
@router.get("/sync/status")
def calibration_sync_status() -> Dict[str, Any]:
"""Return scheduler status and the most recent run's summary."""
return get_calibration_sync_scheduler().status()