diff --git a/handlers/ticket.go b/handlers/ticket.go index 2a5b0fafd..5e08edbc3 100644 --- a/handlers/ticket.go +++ b/handlers/ticket.go @@ -484,6 +484,29 @@ func (th *ticketHandler) ProcessTicketReview(w http.ResponseWriter, r *http.Requ return } + ticketMsg := websocket.TicketMessage{ + BroadcastType: "direct", + SourceSessionID: reviewReq.SourceWebsocket, + Message: fmt.Sprintf("Successful update of %s", reviewReq.Value.TicketUUID), + Action: "process", + TicketDetails: websocket.TicketData{ + FeatureUUID: reviewReq.Value.FeatureUUID, + PhaseUUID: reviewReq.Value.PhaseUUID, + TicketUUID: reviewReq.Value.TicketUUID, + TicketDescription: reviewReq.Value.TicketDescription, + }, + } + + if err := websocket.WebsocketPool.SendTicketMessage(ticketMsg); err != nil { + log.Printf("Failed to send websocket message: %v", err) + w.WriteHeader(http.StatusOK) + json.NewEncoder(w).Encode(map[string]interface{}{ + "ticket": updatedTicket, + "websocket_error": err.Error(), + }) + return + } + log.Printf("Successfully updated ticket %s", reviewReq.Value.TicketUUID) w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(updatedTicket) diff --git a/utils/ticket_processor.go b/utils/ticket_processor.go index 68e907f08..2535fac93 100644 --- a/utils/ticket_processor.go +++ b/utils/ticket_processor.go @@ -11,7 +11,8 @@ type TicketReviewRequest struct { TicketUUID string `json:"ticketUUID" validate:"required"` TicketDescription string `json:"ticketDescription" validate:"required"` } `json:"value"` - RequestUUID string `json:"requestUUID"` + RequestUUID string `json:"requestUUID"` + SourceWebsocket string `json:"sourceWebsocket"` } func ValidateTicketReviewRequest(req *TicketReviewRequest) error {