refactor: integration folders and fix manager bugs

This commit is contained in:
Davidson Gomes
2024-08-23 13:46:51 -03:00
parent beafc62403
commit 6a62ae85fc
17 changed files with 122 additions and 122 deletions

View File

@@ -76,7 +76,7 @@ export class EventController {
return;
}
if (!data[this.name].enabled) {
if (!data[this.name]?.enabled) {
data[this.name].events = [];
} else {
if (0 === data[this.name].events.length) {
@@ -92,7 +92,7 @@ export class EventController {
...data,
},
create: {
enabled: data[this.name].enabled,
enabled: data[this.name]?.enabled,
events: data[this.name].events,
instanceId: this.monitor.waInstances[instanceName].instanceId,
},

View File

@@ -22,7 +22,7 @@ export class WebhookController extends EventController implements EventControlle
throw new BadRequestException('Invalid "url" property');
}
if (!data.webhook.enabled) {
if (!data.webhook?.enabled) {
data.webhook.events = [];
} else {
if (0 === data.webhook.events.length) {
@@ -38,7 +38,7 @@ export class WebhookController extends EventController implements EventControlle
...data.webhook,
},
create: {
enabled: data.webhook.enabled,
enabled: data.webhook?.enabled,
events: data.webhook.events,
instanceId: this.monitor.waInstances[instanceName].instanceId,
url: data.webhook.url,
@@ -61,7 +61,7 @@ export class WebhookController extends EventController implements EventControlle
}: EmitData): Promise<void> {
const instance = (await this.get(instanceName)) as EventDto;
if (!instance || !instance.webhook.enabled) {
if (!instance || !instance.webhook?.enabled) {
return;
}

View File

@@ -97,7 +97,7 @@ export class WebsocketController extends EventController implements EventControl
try {
const instance = (await this.get(instanceName)) as EventDto;
if (!instance?.websocket.enabled) {
if (!instance?.websocket?.enabled) {
return;
}