feat(GRO-2157): navigation export endpoints (Phase 2.3) #190

Merged
Flea Flicker merged 1 commits from flea/gro-2157-navigation-export into dev 2026-06-09 00:16:42 +00:00
Member

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

  • Origin = first stop, destination = last stop, the rest carried as ordered intermediate waypoints, using each stop's stored latitude/longitude in stopOrder.
  • Validates per-platform waypoint limits: Google Maps ≤ 9, Apple Maps ≤ 15 intermediate waypoints → 400 over limit.
  • Response body: { platform, url, stopCount, waypointCount } for the frontend to open as a native deep-link.
  • Empty route → 400; unknown route → 404; non-UUID routeId → 400.
  • Auth: manager (any route) or groomer (own route only). Receptionists denied by the existing api.use("/routes/*", requireRole("manager","groomer")) guard; groomer-own enforced via resolveTargetStaffId.

Implementation

  • New pure-function service src/services/navigationExport.ts (URL builders + per-platform limit constants).
  • Two thin GET handlers in src/routes/routes.ts reusing the existing load-route + authorize pattern.
  • 14 new unit tests (src/__tests__/navigationExport.test.ts): single/two/multi-stop, ordering, encoding, limit boundaries, empty-route, dispatch.

Playbook

  • Updated 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

## 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 - Origin = first stop, destination = last stop, the rest carried as **ordered intermediate waypoints**, using each stop's stored `latitude`/`longitude` in `stopOrder`. - Validates per-platform waypoint limits: **Google Maps ≤ 9**, **Apple Maps ≤ 15** intermediate waypoints → 400 over limit. - Response body: `{ platform, url, stopCount, waypointCount }` for the frontend to open as a native deep-link. - Empty route → 400; unknown route → 404; non-UUID routeId → 400. - **Auth:** manager (any route) or groomer (own route only). Receptionists denied by the existing `api.use("/routes/*", requireRole("manager","groomer"))` guard; groomer-own enforced via `resolveTargetStaffId`. ### Implementation - New pure-function service `src/services/navigationExport.ts` (URL builders + per-platform limit constants). - Two thin GET handlers in `src/routes/routes.ts` reusing the existing load-route + authorize pattern. - **14 new unit tests** (`src/__tests__/navigationExport.test.ts`): single/two/multi-stop, ordering, encoding, limit boundaries, empty-route, dispatch. ### Playbook - Updated `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
Flea Flicker added 1 commit 2026-06-09 00:14:16 +00:00
feat(GRO-2157): navigation export endpoints (Phase 2.3)
CI / Test (pull_request) Successful in 28s
CI / Lint & Typecheck (pull_request) Successful in 31s
CI / Build & Push Docker Images (pull_request) Successful in 1m13s
4138a73ee3
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>
Flea Flicker merged commit cd2f60e282 into dev 2026-06-09 00:16:42 +00:00
Sign in to join this conversation.