mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 03:42:23 -06:00
refactor: integration folders and fix manager bugs
This commit is contained in:
@@ -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,
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user