feat: miler app contract gaps — stop type, COD, pre-pickup skip, profile

Close the gaps the miler-app dev flagged against the deployed contract.

- GET /miler/bookings: return stoptype (pickup|delivery, from status),
  step + road-optimized sequence (cumulativekms/etaminutes/cumulativeeta),
  and codamount/paymentmode. List sorted by step, unsequenced last.
  Lookups batched to avoid N+1.
- POST /miler/bookings/:bookingid/skip: pre-pickup skip that keeps the
  booking assigned and resumable — the "route back" the consignment-only
  delivery skip couldn't give a not-yet-picked-up booking.
- GET /miler/earnings: add cancelled_stops + total_stops for success rate.
- PUT /miler/profile: persist email (to appusers, 409 on unique clash) and
  a new nullable milerprofiles.address column.
- POST /miler/assignments/:id/reject: accept reason from body OR ?reason=.

Notifications read-state and bonuspoints deliberately left as-is — both
need a product/business decision, not code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Suriyakumarvijayanayagam
2026-08-21 11:22:01 +05:30
parent f09efcaf59
commit 531185cf66
4 changed files with 240 additions and 9 deletions

View File

@@ -99,6 +99,11 @@ type MilerProfile struct {
// cutover. Nil for riders created natively in Doormile.
Legacyuserid *int `json:"legacyuserid,omitempty" gorm:"column:legacyuserid;index"`
Defaultvehicletype string `json:"defaultvehicletype" gorm:"column:defaultvehicletype"`
// Address is the rider's home/base address, editable from the app's profile
// screen. App-only until now, so it had nowhere durable to land. Nullable/
// additive. (Email is not duplicated here — it lives on AppUser.Email, the
// login identity, and the profile update path writes it there.)
Address string `json:"address" gorm:"column:address"`
Currentlatitude float64 `json:"currentlatitude" gorm:"column:currentlatitude"`
Currentlongitude float64 `json:"currentlongitude" gorm:"column:currentlongitude"`
Currentpincode string `json:"currentpincode" gorm:"column:currentpincode"`