backend requirements onthe xustomer app
This commit is contained in:
@@ -83,10 +83,58 @@ type PickupBooking struct {
|
||||
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
|
||||
Updatedat time.Time `json:"updatedat" gorm:"column:updatedat;default:CURRENT_TIMESTAMP"`
|
||||
|
||||
// ── Customer-app (doormile_cx) columns ──────────────────────────────────
|
||||
// All additive and nullable/zero-valued, so every existing row and every
|
||||
// console-created booking stays valid without a backfill.
|
||||
|
||||
// Slotid is the pickup window the customer chose, as the opaque id the app
|
||||
// sent back ("slot_20260905_t1"). Preferredpickupfrom/to carry the same
|
||||
// window as real times for the assignment engine; this keeps the customer's
|
||||
// own choice recorded verbatim, so a slot definition edited later cannot
|
||||
// silently rewrite what they picked.
|
||||
Slotid string `json:"slotid" gorm:"column:slotid;size:40"`
|
||||
|
||||
// Customerstage is the operational stage the customer app renders, one of
|
||||
// the nine keys in constants.CxStage*. Distinct from Status, which is the
|
||||
// booking lifecycle the console and the miler app read: Status stops moving
|
||||
// at Converted_To_Consignment while the parcels keep going, and the two
|
||||
// vocabularies are not a renaming of each other. Derived from the same
|
||||
// writes, stored so a read is one row rather than a replay of the history.
|
||||
Customerstage string `json:"customerstage" gorm:"column:customerstage;size:24"`
|
||||
// Customerstatus is active / completed / cancelled. Derived, but sent
|
||||
// explicitly — making the client infer it from a stage is how two surfaces
|
||||
// end up disagreeing about whether an order is finished.
|
||||
Customerstatus string `json:"customerstatus" gorm:"column:customerstatus;size:16"`
|
||||
|
||||
// The estimate range the customer was actually shown at booking time, in
|
||||
// whole rupees. Kept forever, including after settlement: the receipt
|
||||
// renders amountPaid − estimate min as the weight adjustment, and a price
|
||||
// dispute needs the number that was on screen, not a re-run of today's
|
||||
// pricing rules.
|
||||
Estimateminrupees int `json:"estimateminrupees" gorm:"column:estimateminrupees;default:0"`
|
||||
Estimatemaxrupees int `json:"estimatemaxrupees" gorm:"column:estimatemaxrupees;default:0"`
|
||||
// Routekm is the pickup→destination distance the estimate was priced on;
|
||||
// it drives the route outline and the receipt.
|
||||
Routekm float64 `json:"routekm" gorm:"column:routekm;default:0"`
|
||||
|
||||
// Pickuptitle/Pickupsub are the two-line pickup label the customer picked
|
||||
// from the place search ("12 Nehru Street" / "Gandhipuram, Coimbatore
|
||||
// 641012"). Pickupaddress remains the single flat string the rest of the
|
||||
// system uses; these keep the split the app renders without it having to
|
||||
// re-parse one back into two.
|
||||
Pickuptitle string `json:"pickuptitle" gorm:"column:pickuptitle;size:64"`
|
||||
Pickupsub string `json:"pickupsub" gorm:"column:pickupsub"`
|
||||
|
||||
// Cancelreason is free text or one of the app's five presets. Nullable in
|
||||
// spirit — an empty string means the customer gave no reason, which is
|
||||
// allowed.
|
||||
Cancelreason string `json:"cancelreason" gorm:"column:cancelreason;size:120"`
|
||||
|
||||
// Relations
|
||||
Parcels []BookingParcel `json:"parcels" gorm:"foreignKey:Bookingid"`
|
||||
ServiceOptions []BookingServiceOption `json:"serviceoptions" gorm:"foreignKey:Bookingid"`
|
||||
Payments []BookingPayment `json:"payments" gorm:"foreignKey:Bookingid"`
|
||||
Destinations []BookingDestination `json:"destinations" gorm:"foreignKey:Bookingid"`
|
||||
}
|
||||
|
||||
func (PickupBooking) TableName() string {
|
||||
@@ -94,8 +142,16 @@ func (PickupBooking) TableName() string {
|
||||
}
|
||||
|
||||
type BookingParcel struct {
|
||||
Bookingparcelid int `json:"bookingparcelid" gorm:"primaryKey;column:bookingparcelid"`
|
||||
Bookingid int `json:"bookingid" gorm:"column:bookingid"`
|
||||
Bookingparcelid int `json:"bookingparcelid" gorm:"primaryKey;column:bookingparcelid"`
|
||||
Bookingid int `json:"bookingid" gorm:"column:bookingid"`
|
||||
// Bookingdestinationid says which destination this package is going to.
|
||||
// Null on console-created and pre-existing bookings, which have exactly one
|
||||
// delivery address and therefore no ambiguity. On a customer-app booking it
|
||||
// is what lets the miler weigh three packages for Chennai and one for
|
||||
// Kochi and have each weight settle against the right order — without it,
|
||||
// a multi-destination pickup has one pile of parcels and no way to say
|
||||
// which parcel belongs to which tracking number.
|
||||
Bookingdestinationid *int `json:"bookingdestinationid" gorm:"column:bookingdestinationid;index"`
|
||||
Itemcategory string `json:"itemcategory" gorm:"column:itemcategory"`
|
||||
Itemdescription string `json:"itemdescription" gorm:"column:itemdescription"`
|
||||
Declaredvalue float64 `json:"declaredvalue" gorm:"column:declaredvalue"`
|
||||
|
||||
Reference in New Issue
Block a user