backend requirements onthe xustomer app
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"doormile/constants"
|
||||
"doormile/db"
|
||||
"doormile/internal/cxstage"
|
||||
"doormile/internal/routing"
|
||||
"doormile/models"
|
||||
"doormile/utils"
|
||||
@@ -227,8 +228,24 @@ func commitAssignment(booking *models.PickupBooking, candidate *milerCandidate,
|
||||
return fmt.Errorf("update MilerProfile availability: %w", err)
|
||||
}
|
||||
|
||||
// The customer's "Miler assigned" milestone, in the same transaction as the
|
||||
// assignment it describes. The auto-assignment path is how most B2C
|
||||
// bookings get a rider, so without this the customer app's timeline would
|
||||
// only ever advance for manually assigned pickups.
|
||||
if err := cxstage.Record(tx, cxstage.Event{
|
||||
BookingID: booking.Bookingid,
|
||||
Stage: constants.CxStageAssigned,
|
||||
ActorType: constants.CxActorSystem,
|
||||
Source: "internal/assignment.commitAssignment",
|
||||
}); err != nil {
|
||||
tx.Rollback()
|
||||
return fmt.Errorf("record assigned stage: %w", err)
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
|
||||
go cxstage.Notify(booking.Bookingid, nil, constants.CxStageAssigned)
|
||||
|
||||
utils.Info("CRMAssignment: assigned",
|
||||
"booking_id", booking.Bookingid,
|
||||
"miler_id", milerUserID,
|
||||
|
||||
Reference in New Issue
Block a user