feature: add endpoint to retrieve chat data by phone number

This commit is contained in:
foqc
2025-07-21 12:21:45 -05:00
parent 1ca829c00b
commit 68e847d10e
3 changed files with 24 additions and 0 deletions

View File

@@ -696,6 +696,16 @@ export class ChannelStartupService {
});
}
public async findChatByRemoteJid(remoteJid: string) {
if (!remoteJid) return null;
return await this.prismaRepository.chat.findFirst({
where: {
instanceId: this.instanceId,
remoteJid: remoteJid,
},
});
}
public async fetchChats(query: any) {
const remoteJid = query?.where?.remoteJid
? query?.where?.remoteJid.includes('@')