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
+12
-6
@@ -21,6 +21,12 @@ const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||
const { data: context } = await useFetch<ContextResponse>('/api/context')
|
||||
const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||
const { data: presets } = await useFetch<ScenarioPreset[]>('/api/scenarios')
|
||||
|
||||
sensorId.value =
|
||||
sensors.value?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ??
|
||||
sensors.value?.[0]?.id ??
|
||||
sensorId.value
|
||||
|
||||
const { data: forecast } = await useFetch<ForecastResponse>('/api/forecast', {
|
||||
query: computed(() => ({ sensor: sensorId.value, horizon: '7d', scenario: scenario.value })),
|
||||
})
|
||||
@@ -90,7 +96,7 @@ const total = computed(() => days.value.reduce((sum, day) => sum + day.mean, 0))
|
||||
<p class="eyebrow">Forecast · {{ weekLabel(weekStart, weekEnd) }}</p>
|
||||
<OnyxHeadline is="h1">Next week peaks on {{ weekPeak ? formatWeekday(weekPeak.date) : '—' }}.</OnyxHeadline>
|
||||
<p class="lede">
|
||||
A 168-hour mock forecast for <strong>{{ activeSensor?.name ?? 'Stadtgalerie' }}</strong>, aggregated by
|
||||
A 168-hour forecast for <strong>{{ activeSensor?.name ?? 'the selected store' }}</strong>, aggregated by
|
||||
day. The decision, shift blocks and hourly coverage are on <NuxtLink to="/plan">Plan</NuxtLink>.
|
||||
</p>
|
||||
</div>
|
||||
@@ -161,7 +167,7 @@ const total = computed(() => days.value.reduce((sum, day) => sum + day.mean, 0))
|
||||
<template v-if="day.weather">
|
||||
{{ Math.round(day.weather.tempMin) }}–{{ Math.round(day.weather.tempMax) }} °C · {{ day.weather.precipMm.toFixed(1) }} mm
|
||||
</template>
|
||||
<span v-else class="muted">outside mock window</span>
|
||||
<span v-else class="muted">outside weather window</span>
|
||||
</td>
|
||||
<td><OnyxBadge color="neutral" density="compact">{{ day.requiredAtPeak }}</OnyxBadge></td>
|
||||
</tr>
|
||||
@@ -178,11 +184,11 @@ const total = computed(() => days.value.reduce((sum, day) => sum + day.mean, 0))
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Weather strip</OnyxHeadline>
|
||||
<OnyxBadge color="neutral" density="compact">Open-Meteo mock</OnyxBadge>
|
||||
<OnyxBadge color="neutral" density="compact">Open-Meteo context</OnyxBadge>
|
||||
</div>
|
||||
<WeatherStrip :days="weekWeather" />
|
||||
<p v-if="!weekWeather.length" class="small muted table-note">
|
||||
The mock weather window does not cover the plan week.
|
||||
The weather window does not cover the plan week.
|
||||
</p>
|
||||
<p class="small muted table-note">
|
||||
Weather is the main accuracy driver in the model. Holidays are context and a smaller feature.
|
||||
@@ -197,13 +203,13 @@ const total = computed(() => days.value.reduce((sum, day) => sum + day.mean, 0))
|
||||
<ul class="why-list">
|
||||
<li>
|
||||
<OnyxIcon :icon="iconCalendar" size="16px" color="primary" />
|
||||
<span>168 hourly points from the mock 7-day horizon, not a live stream.</span>
|
||||
<span>168 hourly points from the API 7-day horizon, not a live stream.</span>
|
||||
</li>
|
||||
<li>
|
||||
<OnyxIcon :icon="iconChart" size="16px" color="primary" />
|
||||
<span>
|
||||
Mean WAPE {{ meta ? formatPercent(meta.metrics.wape, 1) : '—' }} vs
|
||||
{{ meta ? formatPercent(meta.metrics.baseline_wape, 1) : '—' }} seasonal naive in the mock meta;
|
||||
{{ meta ? formatPercent(meta.metrics.baseline_wape, 1) : '—' }} seasonal naive in the API meta;
|
||||
per-hour uncertainty is real.
|
||||
</span>
|
||||
</li>
|
||||
|
||||
Reference in new issue
Block a user