From 4a7f30f99859f1c9fe95c9eea4c5c9dcd90146b1 Mon Sep 17 00:00:00 2001 From: octo-patch Date: Sun, 26 Apr 2026 09:22:03 +0800 Subject: [PATCH] fix: use correct Prisma JSON path filter in getLastMessage (fixes #2495) The `getLastMessage` function was using an invalid Prisma where-clause syntax `{ key: { remoteJid: number } }` for a JSON/JSONB field. Prisma requires `{ key: { path: ['remoteJid'], equals: value } }` to filter on a JSON field path. This caused a PrismaClientValidationError whenever `archiveChat` or `markChatUnread` called `getLastMessage` with a chat number instead of providing lastMessage directly. Co-Authored-By: Octopus --- .../integrations/channel/whatsapp/whatsapp.baileys.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 60e857fcc..1e44ce1e3 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -3689,7 +3689,7 @@ export class BaileysStartupService extends ChannelStartupService { } public async getLastMessage(number: string) { - const where: any = { key: { remoteJid: number }, instanceId: this.instance.id }; + const where: any = { key: { path: ['remoteJid'], equals: number }, instanceId: this.instanceId }; const messages = await this.prismaRepository.message.findMany({ where,