new changes in hub api messages

This commit is contained in:
2026-07-07 12:47:26 +05:30
parent 707323b68c
commit 808ac953a1
4 changed files with 500 additions and 2 deletions

View File

@@ -116,3 +116,36 @@ type ConsignmentException struct {
func (ConsignmentException) TableName() string {
return "consignmentexceptions"
}
// HubConversation is a hub-scoped chat channel between hub staff and a miler
// at that hub. One conversation per (hubid, mileruserid) pair.
type HubConversation struct {
Hubconversationid int `json:"hubconversationid" gorm:"primaryKey;column:hubconversationid"`
Hubid int `json:"hubid" gorm:"column:hubid;index;not null"`
Mileruserid *int `json:"mileruserid" gorm:"column:mileruserid;index"`
Participantname string `json:"participantname" gorm:"column:participantname;not null"`
Participantrole string `json:"participantrole" gorm:"column:participantrole"`
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
Updatedat time.Time `json:"updatedat" gorm:"column:updatedat;default:CURRENT_TIMESTAMP"`
}
func (HubConversation) TableName() string {
return "hubconversations"
}
// HubMessage is one message within a HubConversation. Sender is "me" (the
// requesting hub staff) or "them" (the other party), matching the hub
// console frontend's bubble-side convention.
type HubMessage struct {
Hubmessageid int `json:"hubmessageid" gorm:"primaryKey;column:hubmessageid"`
Hubconversationid int `json:"hubconversationid" gorm:"column:hubconversationid;index;not null"`
Sender string `json:"sender" gorm:"column:sender;not null"` // me, them
Senderstaffid *int `json:"senderstaffid" gorm:"column:senderstaffid"`
Messagetext string `json:"messagetext" gorm:"column:messagetext;not null"`
Isread bool `json:"isread" gorm:"column:isread;default:false"`
Createdat time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
}
func (HubMessage) TableName() string {
return "hubmessages"
}