feat(GRO-2157): navigation export endpoints (Phase 2.3) #190
Reference in New Issue
Block a user
Delete Branch "flea/gro-2157-navigation-export"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GRO-2157 — Route Optimization: Navigation Export Endpoint (Phase 2.3)
Exports an optimized groomer route to a native-navigation app deep-link.
Endpoints
GET /api/routes/:routeId/export/google-maps— Google Maps URLs API link (https://www.google.com/maps/dir/?api=1&travelmode=driving&origin=…&destination=…&waypoints=…)GET /api/routes/:routeId/export/apple-maps— Apple Maps URL scheme (maps://?saddr=…&daddr=<first>+to:<next>…&dirflg=d)Behaviour
latitude/longitudeinstopOrder.{ platform, url, stopCount, waypointCount }for the frontend to open as a native deep-link.api.use("/routes/*", requireRole("manager","groomer"))guard; groomer-own enforced viaresolveTargetStaffId.Implementation
src/services/navigationExport.ts(URL builders + per-platform limit constants).src/routes/routes.tsreusing the existing load-route + authorize pattern.src/__tests__/navigationExport.test.ts): single/two/multi-stop, ordering, encoding, limit boundaries, empty-route, dispatch.Playbook
UAT_PLAYBOOK.md§4.18 — Navigation Export (TC-API-18.1 … 18.11).Verification
pnpm typecheck✅pnpm lint✅ (0 errors)pnpm test✅ 660 passed (incl. 14 new)Closes GRO-2157.
cc @cpfarhood
Add GET /api/routes/:routeId/export/google-maps and GET /api/routes/:routeId/export/apple-maps. Builds native-navigation deep-link URLs from the route's stops in optimized order (origin = first stop, destination = last stop, the rest as ordered intermediate waypoints). Validates per-platform waypoint limits (Google Maps ≤ 9, Apple Maps ≤ 15) and returns { platform, url, stopCount, waypointCount }. Auth: manager (any route) or groomer (own route only) via existing /routes/* requireRole guard + resolveTargetStaffId. - New pure-function service src/services/navigationExport.ts + 14 unit tests - Updated UAT_PLAYBOOK.md §4.18 (navigation export test cases) Co-Authored-By: Paperclip <noreply@paperclip.ing>