From 53bf789dcb7fc1d44f5ba78d3e05379f7deac124 Mon Sep 17 00:00:00 2001 From: Robson Tenorio Date: Thu, 28 Jul 2022 23:46:21 -0300 Subject: [PATCH] =?UTF-8?q?Filtrar=20Hist=C3=B3rico=20de=20Tickets=20por?= =?UTF-8?q?=20Fila=20e=20Conex=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/MessageServices/ListMessagesService.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/src/services/MessageServices/ListMessagesService.ts b/backend/src/services/MessageServices/ListMessagesService.ts index cd9854f0..c5785b23 100644 --- a/backend/src/services/MessageServices/ListMessagesService.ts +++ b/backend/src/services/MessageServices/ListMessagesService.ts @@ -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; @@ -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,