fix: tickets not disappearing for users that are not members of queue after queue assignment

This commit is contained in:
canove
2021-01-14 12:20:41 -03:00
parent 2cc7b4e508
commit f7f0b01eb3
6 changed files with 41 additions and 38 deletions

View File

@@ -85,25 +85,11 @@ export const update = async (
const { ticketId } = req.params;
const ticketData: TicketData = req.body;
const { ticket, oldStatus, oldUserId } = await UpdateTicketService({
const { ticket } = await UpdateTicketService({
ticketData,
ticketId
});
const io = getIO();
if (ticket.status !== oldStatus || ticket.user?.id !== oldUserId) {
io.to(oldStatus).emit("ticket", {
action: "delete",
ticketId: ticket.id
});
}
io.to(ticket.status).to("notification").to(ticketId).emit("ticket", {
action: "update",
ticket
});
return res.status(200).json(ticket);
};