feat: miler lifecycle — expose reachedat, arrival-fact reached, PATCH addresses

- GET /miler/bookings now returns reachedat + arrivallatitude/arrivallongitude
  on every row, so the app reconstructs "Arrived" (Pickup_Scheduled + reachedat)
  after a restart with no new status.
- reached records arrival as a FACT (timestamp + GPS) and no longer flips the
  booking to Arrived_At_Pickup — the status stays Pickup_Scheduled, matching the
  rider app's derive-from-reachedat model and dropping the console mapping need.
- New PATCH /miler/bookings/:id/addresses: partial pickup/delivery address,
  pincode, coords, city correction before pickup-complete (INVALID_STATE after).
- pickupbookings gains nullable arrivedat/arrivallatitude/arrivallongitude
  (AutoMigrate, additive).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WRaFH5hMRqmUQvVPQsyjZD
This commit is contained in:
Suriyakumarvijayanayagam
2026-08-25 17:49:59 +05:30
parent b0f733ae38
commit aeb859d80b
4 changed files with 134 additions and 16 deletions

View File

@@ -139,6 +139,9 @@ func RegisterRoutes(app *fiber.App, cfg *config.Config) {
milerAuth.Post("/assignments/:id/reject", controllers.RejectMilerAssignment)
milerAuth.Post("/bookings/:bookingid/reached", controllers.BookingReachedCustomer)
// Partial correction of pickup/delivery address, pincode, coords, city at the
// door. Only non-empty fields are written; rejected once picked up.
milerAuth.Patch("/bookings/:bookingid/addresses", controllers.BookingUpdateAddresses)
milerAuth.Post("/bookings/:bookingid/parcel", controllers.BookingParcelConfirm)
// Money and state-conversion mutations are idempotent: a rider retry over a
// bad connection with the same Idempotency-Key replays the first response