- Lead with purpose and exact local/CI commands. - Remove local absolute paths, stale auth notes and unverified claims. - Keep comments to the reason or invariant they protect.
76 lines
2.8 KiB
TypeScript
76 lines
2.8 KiB
TypeScript
// Server-side mock dataset. Shapes follow the Go API contract; files are imported
|
|
// so Nitro bundles them and mock mode renders without the Go API.
|
|
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]
|
|
}
|