feat: miler duty/break tracking, delivery confirmation, earnings, notifications, and support
Adds MilerDutyLog, MilerBreakLog, MilerSupportTicket models and earnings fields on BookingAssignment, plus a new milerAppController.go wiring 10 endpoints under /api/v1/miler for the rider app: duty start/end/status, break start/end, own-bookings listing, delivery confirmation (writes DeliveryProof, completes the assignment, publishes booking.outcome via NATS, and pushes an FCM delivery notification), earnings summaries (daily/weekly/monthly), synthetic notifications, and support tickets. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -106,6 +106,9 @@ type BookingAssignment struct {
|
||||
Completedat *time.Time `json:"completedat" gorm:"column:completedat"`
|
||||
Remarks string `json:"remarks" gorm:"column:remarks"`
|
||||
AgentDecisionID *uint64 `json:"agent_decision_id,omitempty" gorm:"column:agent_decision_id"`
|
||||
Riderkms float64 `json:"riderkms" gorm:"column:riderkms;default:0"`
|
||||
Ridercharges float64 `json:"ridercharges" gorm:"column:ridercharges;default:0"`
|
||||
Bonuspoints int `json:"bonuspoints" gorm:"column:bonuspoints;default:0"`
|
||||
}
|
||||
|
||||
func (BookingAssignment) TableName() string {
|
||||
|
||||
@@ -190,3 +190,49 @@ type HubStaffAccount struct {
|
||||
func (HubStaffAccount) TableName() string {
|
||||
return "hubstaffaccounts"
|
||||
}
|
||||
|
||||
type MilerDutyLog struct {
|
||||
Dutylogid int `json:"dutylogid" gorm:"primaryKey;column:dutylogid"`
|
||||
Userid int `json:"userid" gorm:"column:userid;index;not null"`
|
||||
Loginat time.Time `json:"loginat" gorm:"column:loginat;not null"`
|
||||
Logoutat *time.Time `json:"logoutat" gorm:"column:logoutat"`
|
||||
Onduty bool `json:"onduty" gorm:"column:onduty;default:true"`
|
||||
Startlat float64 `json:"startlat" gorm:"column:startlat"`
|
||||
Startlon float64 `json:"startlon" gorm:"column:startlon"`
|
||||
Lastlat float64 `json:"lastlat" gorm:"column:lastlat"`
|
||||
Lastlon float64 `json:"lastlon" gorm:"column:lastlon"`
|
||||
Totalkms float64 `json:"totalkms" gorm:"column:totalkms;default:0"`
|
||||
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
|
||||
}
|
||||
|
||||
func (MilerDutyLog) TableName() string {
|
||||
return "milerdutylogs"
|
||||
}
|
||||
|
||||
type MilerBreakLog struct {
|
||||
Breaklogid int `json:"breaklogid" gorm:"primaryKey;column:breaklogid"`
|
||||
Userid int `json:"userid" gorm:"column:userid;index;not null"`
|
||||
Dutylogid int `json:"dutylogid" gorm:"column:dutylogid;not null"`
|
||||
Breaktype string `json:"breaktype" gorm:"column:breaktype;default:Personal"`
|
||||
Startat time.Time `json:"startat" gorm:"column:startat;not null"`
|
||||
Endat *time.Time `json:"endat" gorm:"column:endat"`
|
||||
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
|
||||
}
|
||||
|
||||
func (MilerBreakLog) TableName() string {
|
||||
return "milerbreaklogs"
|
||||
}
|
||||
|
||||
type MilerSupportTicket struct {
|
||||
Ticketid int `json:"ticketid" gorm:"primaryKey;column:ticketid"`
|
||||
Userid int `json:"userid" gorm:"column:userid;index;not null"`
|
||||
Subject string `json:"subject" gorm:"column:subject;size:200;not null"`
|
||||
Description string `json:"description" gorm:"column:description;type:text;not null"`
|
||||
Status string `json:"status" gorm:"column:status;default:Open"`
|
||||
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
|
||||
Updatedat time.Time `json:"updatedat" gorm:"column:updatedat;default:CURRENT_TIMESTAMP"`
|
||||
}
|
||||
|
||||
func (MilerSupportTicket) TableName() string {
|
||||
return "milersupporttickets"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user