Add assignment engine, FCM, WebSockets, city gate, and internal APIs
- internal/assignment: GEORADIUS miler assignment with retry/escalation, customer-side provider scoring, FCM notifications on assign - internal/notify: Firebase Admin SDK (FCM) client initialisation - internal/ws: WebSocket handlers for live parcel tracking and customer↔miler chat - middlewares: city gate (pincode prefix validation), internal API key auth, WebSocket JWT auth - controllers: InternalNotify + InternalReassign for machine-to-machine calls; pricing helpers wired into CreateCustomerBooking and CreateCRMBooking - routes: /internal/*, /ws/bookings/:id/track, /ws/bookings/:id/chat - models/users, models/doormile_pricing: new fields for device tokens, assignment state, pricing bands - seed_data.sql: initial pricing seed rows .env and Firebase service-account JSON intentionally excluded. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,24 +83,25 @@ func (AppUser) TableName() string {
|
||||
}
|
||||
|
||||
type MilerProfile struct {
|
||||
Milerprofileid int `json:"milerprofileid" gorm:"primaryKey;column:milerprofileid"`
|
||||
Userid int `json:"userid" gorm:"column:userid;unique;not null"`
|
||||
Applocationid int `json:"applocationid" gorm:"column:applocationid;default:1"`
|
||||
Displayname string `json:"displayname" gorm:"column:displayname;not null"`
|
||||
Phone string `json:"phone" gorm:"column:phone;not null"`
|
||||
Profilephotourl string `json:"profilephotourl" gorm:"column:profilephotourl"`
|
||||
Vehicleid *int `json:"vehicleid" gorm:"column:vehicleid"`
|
||||
Defaultvehicletype string `json:"defaultvehicletype" gorm:"column:defaultvehicletype"`
|
||||
Currentlatitude float64 `json:"currentlatitude" gorm:"column:currentlatitude"`
|
||||
Currentlongitude float64 `json:"currentlongitude" gorm:"column:currentlongitude"`
|
||||
Currentpincode string `json:"currentpincode" gorm:"column:currentpincode"`
|
||||
Availabilitystatus string `json:"availabilitystatus" gorm:"column:availabilitystatus;default:Offline"` // Offline, Available, Assigned, On_Pickup, At_Customer, Picked_Up, On_Delivery, Break, Blocked
|
||||
Rating float64 `json:"rating" gorm:"column:rating;default:5.00"`
|
||||
Totalcompletedpickups int `json:"totalcompletedpickups" gorm:"column:totalcompletedpickups;default:0"`
|
||||
Totalcancelledpickups int `json:"totalcancelledpickups" gorm:"column:totalcancelledpickups;default:0"`
|
||||
Lastlocationupdatedat *time.Time `json:"lastlocationupdatedat" gorm:"column:lastlocationupdatedat"`
|
||||
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
|
||||
Updatedat time.Time `json:"updatedat" gorm:"column:updatedat;default:CURRENT_TIMESTAMP"`
|
||||
Milerprofileid int `json:"milerprofileid" gorm:"primaryKey;column:milerprofileid"`
|
||||
Userid int `json:"userid" gorm:"column:userid;unique;not null"`
|
||||
Applocationid int `json:"applocationid" gorm:"column:applocationid;default:1"`
|
||||
Displayname string `json:"displayname" gorm:"column:displayname;not null"`
|
||||
Phone string `json:"phone" gorm:"column:phone;not null"`
|
||||
Profilephotourl string `json:"profilephotourl" gorm:"column:profilephotourl"`
|
||||
Vehicleid *int `json:"vehicleid" gorm:"column:vehicleid"`
|
||||
Defaultvehicletype string `json:"defaultvehicletype" gorm:"column:defaultvehicletype"`
|
||||
Currentlatitude float64 `json:"currentlatitude" gorm:"column:currentlatitude"`
|
||||
Currentlongitude float64 `json:"currentlongitude" gorm:"column:currentlongitude"`
|
||||
Currentpincode string `json:"currentpincode" gorm:"column:currentpincode"`
|
||||
Availabilitystatus string `json:"availabilitystatus" gorm:"column:availabilitystatus;default:Offline"` // Offline, Available, Assigned, On_Pickup, At_Customer, Picked_Up, On_Delivery, Break, Blocked
|
||||
Rating float64 `json:"rating" gorm:"column:rating;default:5.00"`
|
||||
Totalcompletedpickups int `json:"totalcompletedpickups" gorm:"column:totalcompletedpickups;default:0"`
|
||||
Totalcancelledpickups int `json:"totalcancelledpickups" gorm:"column:totalcancelledpickups;default:0"`
|
||||
Devicetoken string `json:"device_token,omitempty" gorm:"column:device_token"`
|
||||
Lastlocationupdatedat *time.Time `json:"lastlocationupdatedat" gorm:"column:lastlocationupdatedat"`
|
||||
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
|
||||
Updatedat time.Time `json:"updatedat" gorm:"column:updatedat;default:CURRENT_TIMESTAMP"`
|
||||
}
|
||||
|
||||
func (MilerProfile) TableName() string {
|
||||
@@ -117,6 +118,7 @@ type AppCustomer struct {
|
||||
Defaultlatitude float64 `json:"defaultlatitude" gorm:"column:defaultlatitude"`
|
||||
Defaultlongitude float64 `json:"defaultlongitude" gorm:"column:defaultlongitude"`
|
||||
Defaultpincode string `json:"defaultpincode" gorm:"column:defaultpincode"`
|
||||
Devicetoken string `json:"device_token,omitempty" gorm:"column:device_token"`
|
||||
Status string `json:"status" gorm:"column:status;default:Active"` // Active, Blocked, Deleted
|
||||
Configid int `json:"configid" gorm:"column:configid;default:1"`
|
||||
Lastloginat *time.Time `json:"lastloginat" gorm:"column:lastloginat"`
|
||||
|
||||
Reference in New Issue
Block a user