Files
web-nuxt/server/api/train/[jobId].get.ts
Noel Sabia b33e6ff001 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
2026-11-14 06:13:00 +01:00

20 lines
597 B
TypeScript

import { apiRequest, isMockMode } from '../../utils/api'
import { getMockTrainJob } from '../../utils/train-jobs'
export default defineEventHandler(async (event) => {
const jobId = getRouterParam(event, 'jobId')
if (!jobId) {
throw createError({ statusCode: 400, statusMessage: 'jobId is required' })
}
if (isMockMode()) {
const job = getMockTrainJob(jobId)
if (!job) {
throw createError({ statusCode: 404, statusMessage: `Unknown training job: ${jobId}` })
}
return job
}
return apiRequest(`/api/train/${encodeURIComponent(jobId)}`, { control: true })
})