fix(api): expose /webhook/live-positions/track so map trail matches SPA path
The Live Positions SPA calls GET /webhook/live-positions/track, but the read-API only exposed /webhook/vehicle-track. Clicking a vehicle to view its 1-hour trail therefore 404'd even after repointing N8N_BASE. Register the SPA's actual path as a route alias to the same handler (vehicle-track kept as alias), so the only frontend change remains the base URL. Docstring updated to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5703d70aa6
commit
831f683b83
1 changed files with 6 additions and 1 deletions
|
|
@ -16,7 +16,8 @@ is the base URL (the `N8N_BASE` constant in each dashboard SPA):
|
|||
|
||||
GET /webhook/live-positions?cost_centre=&acc_status=
|
||||
→ { summary, geojson } (reporting.fn_live_positions)
|
||||
GET /webhook/vehicle-track?vehicle_number=&hours=
|
||||
GET /webhook/live-positions/track?vehicle_number=&hours=
|
||||
(alias: /webhook/vehicle-track)
|
||||
→ GeoJSON Feature (reporting.fn_vehicle_track)
|
||||
GET /webhook/fleet-dashboard
|
||||
→ { drivers, cost_centres, cities, vehicles } (filter options)
|
||||
|
|
@ -117,6 +118,10 @@ def live_positions(cost_centre: str | None = None, acc_status: str | None = None
|
|||
)
|
||||
|
||||
|
||||
# `/webhook/live-positions/track` is the path the Live Positions SPA actually
|
||||
# calls; `/webhook/vehicle-track` is kept as an alias. Both hit the same handler
|
||||
# so the only frontend change is the base URL (N8N_BASE).
|
||||
@app.get("/webhook/live-positions/track")
|
||||
@app.get("/webhook/vehicle-track")
|
||||
def vehicle_track(vehicle_number: str | None = None, hours: int = 1):
|
||||
veh = _clean(vehicle_number)
|
||||
|
|
|
|||
Loading…
Reference in a new issue