mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-05 17:05:53 +08:00
/api/service/tools/* was a second implementation of the OSM geocoding and taxi routing the Python backend already owns — its own Overpass client, alias matching and scoring. It drifted: it still asked Overpass for `out center tags`, so a runway resolved to the middle of the strip rather than a threshold, which is the runway-endpoint bug the backend fixed. Teaching the copy about runway endpoints would mean maintaining the geometry twice, so the copy goes instead. Forwarding exposes origin_runway_point / dest_runway_point and include_connectors, and inherits the backend's Overpass cache and its radius fallback for aerodromes with no generated OSM area (EDDM), which the copy answered with an empty feature list. Failures now carry an HTTP status as well as the error code in the body; the old copy answered every error with 200. The frequencies call sites needed real types: airportGeocode.ts sat under server/api with no default export, so Nitro registered it as a route whose return type collapsed to any and poisoned the whole API type map. The typecheck was green because of it, not despite it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
19 lines
850 B
TypeScript
19 lines
850 B
TypeScript
import { defineEventHandler, getQuery } from 'h3'
|
|
|
|
import { forwardToRadioBackend } from '../../../utils/radioBackend'
|
|
|
|
/**
|
|
* Compute a taxi route between two points or named aerodrome features.
|
|
*
|
|
* The routing itself lives in the Python backend, which owns the Overpass
|
|
* client and its cache, the airport dataset, and the runway-threshold logic.
|
|
* This route used to be a second implementation of all of it and drifted:
|
|
* it asked Overpass for `out center tags`, so a runway resolved to the centre
|
|
* of the strip instead of a threshold — the runway-endpoint bug the backend
|
|
* fixed with `origin_runway_point` / `dest_runway_point` (start|end|center,
|
|
* default start), which forwarding now exposes here too.
|
|
*/
|
|
export default defineEventHandler(async (event) =>
|
|
forwardToRadioBackend('/api/service/tools/taxiroute', getQuery(event))
|
|
)
|