feat: wire Nitro API to Go, real staffing plan and train proxy

- Replace mock Nitro routes with server-side proxies to the Go API
- /plan reads Go /api/staffing; local assumption edits are a labeled preview
- /simulate reads base and scenario staffing from Go instead of local multipliers
- Route train upload and scenario POST through Nitro with server-only credentials
- Keep NUXT_PUBLIC_USE_MOCK=1 as an explicit dev fallback only
- Match Go's global-peak flat schedule and add a captured Go parity fixture
- Run the web runtime as numeric UID/GID 10001:10001
- Add make check, Gitea CI workflow and a proxy smoke script
This commit is contained in:
Noel Sabia committed 2026-11-14 06:13:00 +01:00
1 parent e8d141ca43
commit b33e6ff001
33 files changed
+1147 -317

No files matched your search

+4 -4
View File
@@ -222,10 +222,10 @@ export function buildStaffing(input: BuildStaffingInput): StaffingBuild {
const covered = hours.filter((h) => h.scheduled_staff >= h.required_staff).length
const coveragePct = hours.length ? Math.round((covered / hours.length) * 1000) / 10 : 0
const cost = hours.reduce((sum, h) => sum + h.scheduled_staff * assumptions.labor_cost_eur_h, 0)
const flatCost = Object.values(byDate).reduce((sum, dayHours) => {
const peak = dayHours.length ? Math.max(...dayHours.map((h) => h.required_staff)) : 0
return sum + peak * dayHours.length * assumptions.labor_cost_eur_h
}, 0)
// CONTRACT.md §5: the flat schedule applies max(required) to every store
// hour. Go uses one global peak, not one peak per day; keep this identical.
const peakRequired = hours.reduce((peak, hour) => Math.max(peak, hour.required_staff), 0)
const flatCost = peakRequired * hours.length * assumptions.labor_cost_eur_h
return {
response: {