chore: Simplified payloads and instance endpoint

This commit is contained in:
Davidson Gomes
2024-06-07 11:09:08 -03:00
parent eed32a3bd9
commit a578384e85
17 changed files with 207 additions and 138 deletions

View File

@@ -369,6 +369,15 @@ export class BaileysStartupService extends ChannelStartupService {
status: 'closed',
});
if (this.configService.get<Database>('DATABASE').ENABLED) {
await this.prismaRepository.instance.update({
where: { id: this.instanceId },
data: {
connectionStatus: 'close',
},
});
}
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot.enabled) {
this.chatwootService.eventWhatsapp(
Events.STATUS_INSTANCE,
@@ -404,6 +413,17 @@ export class BaileysStartupService extends ChannelStartupService {
`,
);
if (this.configService.get<Database>('DATABASE').ENABLED) {
await this.prismaRepository.instance.update({
where: { id: this.instanceId },
data: {
ownerJid: this.instance.wuid,
profilePicUrl: this.instance.profilePictureUrl,
connectionStatus: 'open',
},
});
}
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot.enabled) {
this.chatwootService.eventWhatsapp(
Events.CONNECTION_UPDATE,