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:
1 parent
e8d141ca43
commit
b33e6ff001
33 files changed
+1147
-317
No files matched your search
+16
-7
@@ -6,6 +6,9 @@ import { formatDate, formatDateTime, formatPercent } from '~/utils/format'
|
||||
useHead({ title: 'About the data and limits — PulseCast' })
|
||||
|
||||
const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const usingMock = computed(() => Boolean(config.public.useMock))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -84,10 +87,10 @@ const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Context version</th><td class="mono">{{ meta?.context_version ?? '—' }}</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Coverage</th><td>{{ meta ? `${formatDate(meta.coverage.from)} → ${formatDate(meta.coverage.to)}` : '—' }}</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Validation</th><td>{{ meta ? `WAPE ${formatPercent(meta.metrics.wape, 1)} · baseline ${formatPercent(meta.metrics.baseline_wape, 1)} · R² ${meta.metrics.r2}` : '—' }}</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Weather source</th><td>Open-Meteo archive + forecast (mock context)</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Weather source</th><td>Open-Meteo archive + forecast via `/api/context`</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Holidays</th><td>Baden-Württemberg 2025–2026 public holidays</td></tr>
|
||||
</OnyxTable>
|
||||
<p class="small muted table-note">Meta is rendered from <code>web-nuxt/mock/meta.json</code> until the Go API exists.</p>
|
||||
<p class="small muted table-note">Meta comes from Go <code>/api/meta</code> through the Nitro proxy.</p>
|
||||
</OnyxCard>
|
||||
|
||||
<TrainModelCard />
|
||||
@@ -126,12 +129,18 @@ const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">Mock status</OnyxHeadline>
|
||||
<OnyxHeadline is="h3">Data source</OnyxHeadline>
|
||||
<OnyxBadge :color="usingMock ? 'warning' : 'success'" density="compact">
|
||||
{{ usingMock ? 'Mock mode' : 'Go API' }}
|
||||
</OnyxBadge>
|
||||
</div>
|
||||
<p class="small muted" style="margin-top: 0">
|
||||
Mock data renders the full app before the API exists. Nitro routes in <code>server/api</code> mirror the
|
||||
contract. Versions and metrics are sample values; the plan heuristic is implemented once in
|
||||
<code>shared/staffing.ts</code> and reused by the mock API.
|
||||
<p v-if="usingMock" class="small muted" style="margin-top: 0">
|
||||
Explicit dev fallback: <code>NUXT_PUBLIC_USE_MOCK=1</code>. Mock JSON renders the app without the Go
|
||||
service; the plan heuristic is the shared implementation in <code>shared/staffing.ts</code>.
|
||||
</p>
|
||||
<p v-else class="small muted" style="margin-top: 0">
|
||||
The browser only talks to this Nuxt origin. Nitro proxies `/api/*` to the Go API at
|
||||
<code>NUXT_API_INTERNAL_BASE</code>; forecast, context and meta are served from there.
|
||||
</p>
|
||||
<p class="small muted" style="margin: 0">
|
||||
Last context update: {{ meta ? formatDateTime(meta.context_version) : '—' }}
|
||||
|
||||
Reference in new issue
Block a user