From 65f116bdd96528d71663a73d785b705d21edcf2e Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Tue, 3 Dec 2024 11:23:23 +0500 Subject: [PATCH 1/2] implement ticketMessage structure for websocket communication in back end --- db/structs.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/db/structs.go b/db/structs.go index 03501217e..662333d46 100644 --- a/db/structs.go +++ b/db/structs.go @@ -973,6 +973,30 @@ type Tickets struct { UpdatedAt time.Time `gorm:"type:timestamp;default:current_timestamp" json:"updated_at"` } +type BroadcastType string + +const ( + PoolBroadcast BroadcastType = "pool" + + DirectBroadcast BroadcastType = "direct" +) + +type ActionType string + +const ( + ProcessAction ActionType = "process" + + MessageAction ActionType = "message" +) + +type TicketMessage struct { + BroadcastType BroadcastType `gorm:"type:varchar(50)" json:"broadcastType"` + SourceSessionID string `gorm:"type:varchar(50)" json:"sourceSessionID"` + Message string `gorm:"type:text" json:"message"` + Action ActionType `gorm:"type:varchar(50)" json:"action"` + TicketDetails Tickets `json:"ticketDetails"` +} + func (Person) TableName() string { return "people" } From 9d5b0a9919bea3bae0f64cb11fa7110b0be837b9 Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Tue, 3 Dec 2024 11:45:13 +0500 Subject: [PATCH 2/2] update --- db/structs.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/structs.go b/db/structs.go index 662333d46..677eb31aa 100644 --- a/db/structs.go +++ b/db/structs.go @@ -990,10 +990,10 @@ const ( ) type TicketMessage struct { - BroadcastType BroadcastType `gorm:"type:varchar(50)" json:"broadcastType"` - SourceSessionID string `gorm:"type:varchar(50)" json:"sourceSessionID"` - Message string `gorm:"type:text" json:"message"` - Action ActionType `gorm:"type:varchar(50)" json:"action"` + BroadcastType BroadcastType `json:"broadcastType"` + SourceSessionID string `json:"sourceSessionID"` + Message string `json:"message"` + Action ActionType `json:"action"` TicketDetails Tickets `json:"ticketDetails"` }