mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
feat(weather): migrate /api/weather to the NestJS pilot module (L1) (#1053)
First strangler migration (L1): /api/weather is served by a NestJS module.
- @trek/shared/weather Zod contract; Nest controller byte-identical to the legacy Express route (paths, query params, status codes, { error } bodies, lang default, ApiError/500 passthrough). Service reuses getWeather/getDetailedWeather (+ shared cache; MCP tools unchanged).
- Strangler routes /api/weather to Nest by default; the legacy Express route + its migration-time parity test were decommissioned in this PR.
- Frontend (FE2): weatherApi typed against the @trek/shared WeatherResult contract.
- Harness: reusable Nest-vs-Express parity harness, e2e harness (temp SQLite + seed/cookie helpers, real JwtAuthGuard), src/nest coverage gate raised to >=80%, src/nest test guide.
- Verified end-to-end on a prod mirror (dev1): 401/400/200 via Nest with real Open-Meteo data, Express route gone.
This commit is contained in:
+10
-2
@@ -29,9 +29,10 @@ export default defineConfig({
|
||||
reportsDirectory: './coverage',
|
||||
include: ['src/**/*.ts'],
|
||||
// Coverage gate scoped to the new NestJS code only — the legacy codebase
|
||||
// is intentionally ungated. Ratchet these up as more modules are migrated.
|
||||
// is intentionally ungated. Raised to the DoD's >=80% bar once the first
|
||||
// module (weather) landed; ratchet further as more modules are migrated.
|
||||
thresholds: {
|
||||
'src/nest/**/*.ts': { statements: 60, branches: 55, functions: 55, lines: 60 },
|
||||
'src/nest/**/*.ts': { statements: 80, branches: 80, functions: 80, lines: 80 },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -57,5 +58,12 @@ export default defineConfig({
|
||||
import.meta.url
|
||||
).pathname,
|
||||
},
|
||||
// The server build emits @trek/shared next to its source (shared/src/*.js,
|
||||
// needed by the prod dist via tsc-alias). Vite's default extension order
|
||||
// prefers .js over .ts, so after a build the tests would load that compiled
|
||||
// CJS instead of the source — and its `require('zod')` is unresolvable from
|
||||
// the shared/ dir on CI (only server deps are installed there). Resolve .ts
|
||||
// first so tests always run the source, whose zod import resolves via Vite.
|
||||
extensions: ['.ts', '.mts', '.mjs', '.js', '.cts', '.cjs', '.tsx', '.jsx', '.json'],
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user