mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
Save chat names for groups identification
This commit is contained in:
parent
668f477218
commit
926197b1ba
@ -114,6 +114,7 @@ model Session {
|
||||
model Chat {
|
||||
id String @id @default(cuid())
|
||||
remoteJid String @db.VarChar(100)
|
||||
name String? @db.VarChar(100)
|
||||
labels Json? @db.Json
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
|
@ -114,6 +114,7 @@ model Session {
|
||||
model Chat {
|
||||
id String @id @default(cuid())
|
||||
remoteJid String @db.VarChar(100)
|
||||
name String? @db.VarChar(100)
|
||||
labels Json? @db.JsonB
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
|
@ -722,7 +722,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
const chatsToInsert = chats
|
||||
.filter((chat) => !existingChatIdSet.has(chat.id))
|
||||
.map((chat) => ({ remoteJid: chat.id, instanceId: this.instanceId }));
|
||||
.map((chat) => ({ remoteJid: chat.id, instanceId: this.instanceId, name: chat.name }));
|
||||
|
||||
this.sendDataWebhook(Events.CHATS_UPSERT, chatsToInsert);
|
||||
|
||||
@ -754,10 +754,9 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
where: {
|
||||
instanceId: this.instanceId,
|
||||
remoteJid: chat.id,
|
||||
name: chat.name,
|
||||
},
|
||||
data: {
|
||||
remoteJid: chat.id,
|
||||
},
|
||||
data: { remoteJid: chat.id },
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -900,7 +899,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
const chatsRaw: any[] = [];
|
||||
const chatsRaw: { remoteJid: string; instanceId: string; name?: string }[] = [];
|
||||
const chatsRepository = new Set(
|
||||
(
|
||||
await this.prismaRepository.chat.findMany({
|
||||
@ -917,6 +916,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
chatsRaw.push({
|
||||
remoteJid: chat.id,
|
||||
instanceId: this.instanceId,
|
||||
name: chat.name,
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user