Skip to content

Commit

Permalink
Filtrar Histórico de Tickets por Fila e Conexão
Browse files Browse the repository at this point in the history
  • Loading branch information
rtenorioh committed Jul 29, 2022
1 parent 48cb61c commit 53bf789
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions backend/src/services/MessageServices/ListMessagesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import AppError from "../../errors/AppError";
import Message from "../../models/Message";
import Ticket from "../../models/Ticket";
import ShowTicketService from "../TicketServices/ShowTicketService";
import { Op } from "sequelize";

interface Request {
ticketId: string;
Expand Down Expand Up @@ -42,8 +43,14 @@ const ListMessagesService = async ({
},
{
model: Ticket,
where: {contactId: ticket.contactId },
required: true
where: {
contactId: ticket.contactId,
whatsappId: ticket.whatsappId,
queueId: {
[Op.or]: [ticket.queueId, null],
},
},
required: true,
}
],
offset,
Expand Down

0 comments on commit 53bf789

Please sign in to comment.