Skip to content

Commit 4a7f30f

Browse files
octo-patchocto-patch
andcommitted
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 <liyuan851277048@icloud.com>
1 parent cd800f2 commit 4a7f30f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3689,7 +3689,7 @@ export class BaileysStartupService extends ChannelStartupService {
36893689
}
36903690

36913691
public async getLastMessage(number: string) {
3692-
const where: any = { key: { remoteJid: number }, instanceId: this.instance.id };
3692+
const where: any = { key: { path: ['remoteJid'], equals: number }, instanceId: this.instanceId };
36933693

36943694
const messages = await this.prismaRepository.message.findMany({
36953695
where,

0 commit comments

Comments
 (0)