mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-21 21:29:25 +00:00
improvement: block open another ticket from same contact when already a open / pending ticket
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import AppError from "../../errors/AppError";
|
||||
import CheckContactOpenTickets from "../../helpers/CheckContactOpenTickets";
|
||||
import GetDefaultWhatsApp from "../../helpers/GetDefaultWhatsApp";
|
||||
import Ticket from "../../models/Ticket";
|
||||
|
||||
@@ -19,6 +20,8 @@ const CreateTicketService = async ({
|
||||
throw new AppError("No default WhatsApp found. Check Connection page.");
|
||||
}
|
||||
|
||||
await CheckContactOpenTickets(contactId);
|
||||
|
||||
const { id }: Ticket = await defaultWhatsapp.$create("ticket", {
|
||||
contactId,
|
||||
status,
|
||||
|
||||
Reference in New Issue
Block a user