mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 03:39:29 +00:00
improvement: blocking reopen a ticket when already a ticket open for that contact
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import AppError from "../../errors/AppError";
|
||||
import CheckContactOpenTickets from "../../helpers/CheckContactOpenTickets";
|
||||
import SetTicketMessagesAsRead from "../../helpers/SetTicketMessagesAsRead";
|
||||
import Contact from "../../models/Contact";
|
||||
import Ticket from "../../models/Ticket";
|
||||
@@ -45,6 +46,10 @@ const UpdateTicketService = async ({
|
||||
|
||||
const oldStatus = ticket.status;
|
||||
|
||||
if (oldStatus === "closed") {
|
||||
await CheckContactOpenTickets(ticket.contact.id);
|
||||
}
|
||||
|
||||
await ticket.update({
|
||||
status,
|
||||
userId
|
||||
|
||||
Reference in New Issue
Block a user