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

@@ -58,7 +58,7 @@ export class ChannelStartupService {
this.instance.token = instance.token;
this.instance.businessId = instance.businessId;
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot.enabled) {
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot?.enabled) {
this.chatwootService.eventWhatsapp(
Events.STATUS_INSTANCE,
{ instanceName: this.instance.name },
@@ -241,7 +241,7 @@ export class ChannelStartupService {
instanceId: this.instanceId,
},
data: {
enabled: data.enabled,
enabled: data?.enabled,
accountId: data.accountId,
token: data.token,
url: data.url,
@@ -269,7 +269,7 @@ export class ChannelStartupService {
await this.prismaRepository.chatwoot.create({
data: {
enabled: data.enabled,
enabled: data?.enabled,
accountId: data.accountId,
token: data.token,
url: data.url,
@@ -312,7 +312,7 @@ export class ChannelStartupService {
const ignoreJidsArray = Array.isArray(data.ignoreJids) ? data.ignoreJids.map((event) => String(event)) : [];
return {
enabled: data.enabled,
enabled: data?.enabled,
accountId: data.accountId,
token: data.token,
url: data.url,
@@ -332,7 +332,7 @@ export class ChannelStartupService {
}
public clearCacheChatwoot() {
if (this.localChatwoot.enabled) {
if (this.localChatwoot?.enabled) {
this.chatwootService.getCache()?.deleteAll(this.instanceName);
}
}
@@ -355,7 +355,7 @@ export class ChannelStartupService {
public async setProxy(data: ProxyDto) {
await this.prismaRepository.proxy.create({
data: {
enabled: data.enabled,
enabled: data?.enabled,
host: data.host,
port: data.port,
protocol: data.protocol,