mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 04:02:54 -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 {
|
model Chat {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
remoteJid String @db.VarChar(100)
|
remoteJid String @db.VarChar(100)
|
||||||
|
name String? @db.VarChar(100)
|
||||||
labels Json? @db.Json
|
labels Json? @db.Json
|
||||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||||
|
@ -114,6 +114,7 @@ model Session {
|
|||||||
model Chat {
|
model Chat {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
remoteJid String @db.VarChar(100)
|
remoteJid String @db.VarChar(100)
|
||||||
|
name String? @db.VarChar(100)
|
||||||
labels Json? @db.JsonB
|
labels Json? @db.JsonB
|
||||||
createdAt DateTime? @default(now()) @db.Timestamp
|
createdAt DateTime? @default(now()) @db.Timestamp
|
||||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||||
|
@ -722,7 +722,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
|
|
||||||
const chatsToInsert = chats
|
const chatsToInsert = chats
|
||||||
.filter((chat) => !existingChatIdSet.has(chat.id))
|
.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);
|
this.sendDataWebhook(Events.CHATS_UPSERT, chatsToInsert);
|
||||||
|
|
||||||
@ -754,10 +754,9 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
where: {
|
where: {
|
||||||
instanceId: this.instanceId,
|
instanceId: this.instanceId,
|
||||||
remoteJid: chat.id,
|
remoteJid: chat.id,
|
||||||
|
name: chat.name,
|
||||||
},
|
},
|
||||||
data: {
|
data: { remoteJid: chat.id },
|
||||||
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(
|
const chatsRepository = new Set(
|
||||||
(
|
(
|
||||||
await this.prismaRepository.chat.findMany({
|
await this.prismaRepository.chat.findMany({
|
||||||
@ -917,6 +916,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
chatsRaw.push({
|
chatsRaw.push({
|
||||||
remoteJid: chat.id,
|
remoteJid: chat.id,
|
||||||
instanceId: this.instanceId,
|
instanceId: this.instanceId,
|
||||||
|
name: chat.name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user