From 4dafa46b7b3457590393d921ca5258d1dd9b4bf5 Mon Sep 17 00:00:00 2001 From: Anderson de Lima Date: Wed, 30 Jul 2025 18:41:17 -0300 Subject: [PATCH] =?UTF-8?q?Corrige=20filtro=20de=20mensagens=20com=20OR=20?= =?UTF-8?q?din=C3=A2mico=20para=20conseguir=20filtrar=20por=20remoteJid=20?= =?UTF-8?q?ou=20senderPn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../whatsapp/whatsapp.baileys.service.ts | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index b9c7e06c..2e139dcd 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -4505,11 +4505,13 @@ export class BaileysStartupService extends ChannelStartupService { keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {}, keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {}, keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {}, + { + OR: [ + keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {}, + keyFilters?.senderPn ? { key: { path: ['senderPn'], equals: keyFilters?.senderPn } } : {}, + ] + } ], - OR: [ - keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {}, - keyFilters?.senderPn ? { key: { path: ['senderPn'], equals: keyFilters?.senderPn } } : {}, - ] }, }); @@ -4532,11 +4534,14 @@ export class BaileysStartupService extends ChannelStartupService { keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {}, keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {}, keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {}, + { + OR: [ + keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {}, + keyFilters?.senderPn ? { key: { path: ['senderPn'], equals: keyFilters?.senderPn } } : {}, + ] + } ], - OR: [ - keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {}, - keyFilters?.senderPn ? { key: { path: ['senderPn'], equals: keyFilters?.senderPn } } : {}, - ] + }, orderBy: { messageTimestamp: 'desc' }, skip: query.offset * (query?.page === 1 ? 0 : (query?.page as number) - 1),