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

+28
View File
@@ -62,6 +62,34 @@ describe('buildStaffing', () => {
expect(build.response.summary.overstaffed_hours).toBeGreaterThan(0)
expect(build.response.summary.understaffed_hours).toBe(0)
})
it('compares the flat schedule against the global peak, matching the Go API', () => {
// Monday needs 5, Tuesday needs 10. CONTRACT §5 applies max(required) to
// every hour: 10 * 20 h * €16 = €3200, not a per-day peak sum.
const points = [
...mondayPoints(100).map((point, index) => ({
...point,
t: new Date(Date.UTC(2026, 10, 15, 23 + index)).toISOString().replace('.000Z', 'Z'),
})),
...mondayPoints(200).map((point, index) => ({
...point,
t: new Date(Date.UTC(2026, 10, 16, 23 + index)).toISOString().replace('.000Z', 'Z'),
})),
]
const build = buildStaffing({
sensor: 'hn-stadtgalerie-01',
scenario: 'base',
standard: 'standard',
points,
weekStart: '2026-11-16',
data_version: 'data',
model_version: 'model',
context_version: 'context',
})
expect(build.response.summary.flat_schedule_cost_eur).toBe(3200)
expect(build.response.summary.cost_eur).toBe(2400)
})
})
describe('applyScenario', () => {