mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 12:22:21 -06:00
Refactor instance deletion logic and enhance WhatsApp connection updates
- Updated the `deleteInstance` method to allow logout for instances in 'connecting' or 'open' states, improving instance management. - Enhanced the `BaileysStartupService` to include additional profile information (wuid, profileName, profilePictureUrl) in connection update webhooks. - Removed redundant webhook data sending logic, streamlining connection state updates for better performance. - Adjusted settings schema to ensure required fields are properly validated.
This commit is contained in:
@@ -410,15 +410,11 @@ export class InstanceController {
|
||||
|
||||
public async deleteInstance({ instanceName }: InstanceDto) {
|
||||
const { instance } = await this.connectionState({ instanceName });
|
||||
|
||||
if (instance.state === 'open') {
|
||||
throw new BadRequestException('The "' + instanceName + '" instance needs to be disconnected');
|
||||
}
|
||||
try {
|
||||
const waInstances = this.waMonitor.waInstances[instanceName];
|
||||
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED) waInstances?.clearCacheChatwoot();
|
||||
|
||||
if (instance.state === 'connecting') {
|
||||
if (instance.state === 'connecting' || instance.state === 'open') {
|
||||
await this.logout({ instanceName });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user