fix: admin console reads reachedat on booking rows (JSON tag arrivedat->reachedat)

The Admin Console derives Arrived from Pickup_Scheduled + reachedat != null,
but GetAdminBookings serializes the PickupBooking struct raw and the arrival
field emitted json arrivedat, not reachedat, so the console never saw the
arrival. Align the wire name to reachedat (miler app and /reached already use
it); DB column stays arrivedat.

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-26 15:25:42 +05:30
parent aeb859d80b
commit 549a35a63a

View File

@@ -47,7 +47,11 @@ type PickupBooking struct {
// pickup point. Nullable — a booking that was never reached has no arrival.
// arrivallatitude/longitude are the rider's actual GPS at the moment they
// tapped "arrived", kept as a durable record separate from live telemetry.
Arrivedat *time.Time `json:"arrivedat" gorm:"column:arrivedat"`
// JSON name is reachedat (not arrivedat): the miler app, the /reached
// response and the Admin Console all key off reachedat — the console derives
// its "Arrived" display from Pickup_Scheduled + reachedat != null. The DB
// column stays arrivedat.
Arrivedat *time.Time `json:"reachedat" gorm:"column:arrivedat"`
Arrivallatitude *float64 `json:"arrivallatitude" gorm:"column:arrivallatitude"`
Arrivallongitude *float64 `json:"arrivallongitude" gorm:"column:arrivallongitude"`
Consignmentid *int `json:"consignmentid" gorm:"column:consignmentid"`