fix(ext-api): /secretaria/ask usa chat.jid (não remoteJid inexistente)

prisma.chat.findFirst filtrava por remoteJid, que não existe no model Chat (é jid)
→ 500 em todo /secretaria/ask. Corrigido; endpoint retorna o reply normalmente.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
VPS 4 Deploy Agent
2026-06-28 16:53:13 +02:00
parent 9ba3c78752
commit 62ba985ebe
3 changed files with 3 additions and 3 deletions
@@ -789,7 +789,7 @@ function buildExtRoutes(prisma, manager, db, config, hooks, io) {
});
// SEC-01+SEC-11: envia reply via WA e persiste no banco principal
const chat = await prisma.chat.findFirst({
where: { tenantId, remoteJid: chatId },
where: { tenantId, jid: chatId },
orderBy: { updatedAt: 'desc' },
select: { id: true, instanceId: true },
});