fetchContacts - nestordavalos

This commit is contained in:
Leandro Santos Rocha 2025-04-22 16:12:47 -03:00 committed by GitHub
parent 3ab75faff7
commit eeedfb0e2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -513,7 +513,20 @@ export class ChannelStartupService {
contactFindManyArgs.skip = query.offset * (validPage - 1);
}
return await this.prismaRepository.contact.findMany(contactFindManyArgs);
const contacts = await this.prismaRepository.contact.findMany(contactFindManyArgs);
return contacts.map((contact) => {
const remoteJid = contact.remoteJid;
const isGroup = remoteJid.endsWith('@g.us');
const isSaved = !!contact.pushName || !!contact.profilePicUrl;
const type = isGroup ? 'group' : isSaved ? 'contact' : 'group_member';
return {
...contact,
isGroup,
isSaved,
type,
};
});
}
public cleanMessageData(message: any) {