mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 11:49:19 +00:00
feat: update tickets list on transfer
This commit is contained in:
@@ -76,14 +76,14 @@ export const update = async (
|
||||
const { ticketId } = req.params;
|
||||
const ticketData: TicketData = req.body;
|
||||
|
||||
const { ticket, oldStatus, ticketUser } = await UpdateTicketService({
|
||||
const { ticket, oldStatus, oldUserId } = await UpdateTicketService({
|
||||
ticketData,
|
||||
ticketId
|
||||
});
|
||||
|
||||
const io = getIO();
|
||||
|
||||
if (ticket.status !== oldStatus) {
|
||||
if (ticket.status !== oldStatus || ticket.user?.id !== oldUserId) {
|
||||
io.to(oldStatus).emit("ticket", {
|
||||
action: "delete",
|
||||
ticketId: ticket.id
|
||||
@@ -92,8 +92,7 @@ export const update = async (
|
||||
|
||||
io.to(ticket.status).to("notification").to(ticketId).emit("ticket", {
|
||||
action: "updateStatus",
|
||||
ticket,
|
||||
user: ticketUser
|
||||
ticket
|
||||
});
|
||||
|
||||
return res.status(200).json(ticket);
|
||||
|
||||
@@ -16,9 +16,6 @@ type IndexQuery = {
|
||||
};
|
||||
|
||||
export const index = async (req: Request, res: Response): Promise<Response> => {
|
||||
if (req.user.profile !== "admin") {
|
||||
throw new AppError("ERR_NO_PERMISSION", 403); // should be handled better.
|
||||
}
|
||||
const { searchParam, pageNumber } = req.query as IndexQuery;
|
||||
|
||||
const { users, count, hasMore } = await ListUsersService({
|
||||
|
||||
Reference in New Issue
Block a user