Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement WebSocket Notifications for Ticket Review Updates #2104

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions handlers/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,29 @@ func (th *ticketHandler) ProcessTicketReview(w http.ResponseWriter, r *http.Requ
return
}

ticketMsg := websocket.TicketMessage{
BroadcastType: "direct",
SourceSessionID: reviewReq.RequestUUID,
Copy link
Contributor

@humansinstitute humansinstitute Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saithsab877 -
Can we change this. This should be 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)
Expand Down
Loading