mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-21 05:09:18 +00:00
✨ open more than one ticket per user as long as it is using another whatsapp
This commit is contained in:
@@ -2,9 +2,12 @@ import { Op } from "sequelize";
|
||||
import AppError from "../errors/AppError";
|
||||
import Ticket from "../models/Ticket";
|
||||
|
||||
const CheckContactOpenTickets = async (contactId: number): Promise<void> => {
|
||||
const CheckContactOpenTickets = async (
|
||||
contactId: number,
|
||||
whatsappId: number
|
||||
): Promise<void> => {
|
||||
const ticket = await Ticket.findOne({
|
||||
where: { contactId, status: { [Op.or]: ["open", "pending"] } }
|
||||
where: { contactId, whatsappId, status: { [Op.or]: ["open", "pending"] } }
|
||||
});
|
||||
|
||||
if (ticket) {
|
||||
|
||||
Reference in New Issue
Block a user