mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-15 03:32:55 -06:00
feat: add disconnection information to BaileysStartupService and Instance model
- Updated BaileysStartupService to include disconnection handling logic. - Enhanced Instance model to store disconnection status and details.
This commit is contained in:
parent
258f56759c
commit
1c3bea4225
@ -57,6 +57,9 @@ model Instance {
|
|||||||
number String? @db.VarChar(100)
|
number String? @db.VarChar(100)
|
||||||
token String? @unique @db.VarChar(255)
|
token String? @unique @db.VarChar(255)
|
||||||
clientName String? @db.VarChar(100)
|
clientName String? @db.VarChar(100)
|
||||||
|
disconnectionReasonCode Int? @db.Int
|
||||||
|
disconnectionObject Json? @db.Json
|
||||||
|
disconnectionAt DateTime? @db.Timestamp
|
||||||
createdAt DateTime? @default(now()) @db.Timestamp
|
createdAt DateTime? @default(now()) @db.Timestamp
|
||||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||||
Chat Chat[]
|
Chat Chat[]
|
||||||
|
@ -71,6 +71,9 @@ model Instance {
|
|||||||
businessId String? @db.VarChar(100)
|
businessId String? @db.VarChar(100)
|
||||||
token String? @db.VarChar(255)
|
token String? @db.VarChar(255)
|
||||||
clientName String? @db.VarChar(100)
|
clientName String? @db.VarChar(100)
|
||||||
|
disconnectionReasonCode Int? @db.Integer
|
||||||
|
disconnectionObject Json? @db.JsonB
|
||||||
|
disconnectionAt DateTime? @db.Timestamp
|
||||||
createdAt DateTime? @default(now()) @db.Timestamp
|
createdAt DateTime? @default(now()) @db.Timestamp
|
||||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||||
Chat Chat[]
|
Chat Chat[]
|
||||||
|
@ -397,6 +397,9 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
this.sendDataWebhook(Events.STATUS_INSTANCE, {
|
this.sendDataWebhook(Events.STATUS_INSTANCE, {
|
||||||
instance: this.instance.name,
|
instance: this.instance.name,
|
||||||
status: 'closed',
|
status: 'closed',
|
||||||
|
disconnectionAt: new Date(),
|
||||||
|
disconnectionReasonCode: statusCode,
|
||||||
|
disconnectionObject: JSON.stringify(lastDisconnect),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.configService.get<Database>('DATABASE').ENABLED) {
|
if (this.configService.get<Database>('DATABASE').ENABLED) {
|
||||||
@ -404,6 +407,9 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
where: { id: this.instanceId },
|
where: { id: this.instanceId },
|
||||||
data: {
|
data: {
|
||||||
connectionStatus: 'close',
|
connectionStatus: 'close',
|
||||||
|
disconnectionAt: new Date(),
|
||||||
|
disconnectionReasonCode: statusCode,
|
||||||
|
disconnectionObject: JSON.stringify(lastDisconnect),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user