- 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
77 lines
2.8 KiB
TypeScript
77 lines
2.8 KiB
TypeScript
// Server-side mock dataset. Shapes follow /home/noel/Documents/Hackathon_2026/CONTRACT.md.
|
|
// The files are imported (not read from disk at runtime) so the Nitro build bundles them
|
|
// into the SSR output and the app renders before the Go API exists.
|
|
import context from '../../mock/context.json'
|
|
import demo from '../../mock/demo.json'
|
|
import meta from '../../mock/meta.json'
|
|
import scenario from '../../mock/scenario.json'
|
|
import sensors from '../../mock/sensors.json'
|
|
|
|
import forecast01 from '../../mock/forecast/hn-stadtgalerie-01.json'
|
|
import forecast02 from '../../mock/forecast/hn-kaiserstrasse-02.json'
|
|
import forecast03 from '../../mock/forecast/hn-marktplatz-03.json'
|
|
import forecast04 from '../../mock/forecast/hn-kilianskirche-04.json'
|
|
import forecast05 from '../../mock/forecast/hn-rathaus-05.json'
|
|
import forecast06 from '../../mock/forecast/hn-neckartor-06.json'
|
|
import forecast07 from '../../mock/forecast/hn-suelmerstrasse-07.json'
|
|
import forecast08 from '../../mock/forecast/hn-harmonie-08.json'
|
|
|
|
import series01 from '../../mock/series/hn-stadtgalerie-01.json'
|
|
import series02 from '../../mock/series/hn-kaiserstrasse-02.json'
|
|
import series03 from '../../mock/series/hn-marktplatz-03.json'
|
|
import series04 from '../../mock/series/hn-kilianskirche-04.json'
|
|
import series05 from '../../mock/series/hn-rathaus-05.json'
|
|
import series06 from '../../mock/series/hn-neckartor-06.json'
|
|
import series07 from '../../mock/series/hn-suelmerstrasse-07.json'
|
|
import series08 from '../../mock/series/hn-harmonie-08.json'
|
|
|
|
import type {
|
|
ContextResponse,
|
|
ForecastResponse,
|
|
MetaResponse,
|
|
ScenarioState,
|
|
Sensor,
|
|
SeriesResponse,
|
|
} from '../../shared/types'
|
|
|
|
export const mockMeta = meta as MetaResponse
|
|
export const mockContext = context as ContextResponse
|
|
export const mockSensors = sensors as Sensor[]
|
|
export const mockScenario = scenario as ScenarioState
|
|
export const mockDemo = demo as {
|
|
now: string
|
|
plan_start: string
|
|
plan_end: string
|
|
timezone: string
|
|
}
|
|
|
|
const forecasts: Record<string, ForecastResponse> = {
|
|
'hn-stadtgalerie-01': forecast01,
|
|
'hn-kaiserstrasse-02': forecast02,
|
|
'hn-marktplatz-03': forecast03,
|
|
'hn-kilianskirche-04': forecast04,
|
|
'hn-rathaus-05': forecast05,
|
|
'hn-neckartor-06': forecast06,
|
|
'hn-suelmerstrasse-07': forecast07,
|
|
'hn-harmonie-08': forecast08,
|
|
} as Record<string, ForecastResponse>
|
|
|
|
const series: Record<string, SeriesResponse> = {
|
|
'hn-stadtgalerie-01': series01,
|
|
'hn-kaiserstrasse-02': series02,
|
|
'hn-marktplatz-03': series03,
|
|
'hn-kilianskirche-04': series04,
|
|
'hn-rathaus-05': series05,
|
|
'hn-neckartor-06': series06,
|
|
'hn-suelmerstrasse-07': series07,
|
|
'hn-harmonie-08': series08,
|
|
} as Record<string, SeriesResponse>
|
|
|
|
export function getMockForecast(sensorId: string): ForecastResponse | undefined {
|
|
return forecasts[sensorId]
|
|
}
|
|
|
|
export function getMockSeries(sensorId: string): SeriesResponse | undefined {
|
|
return series[sensorId]
|
|
}
|