fix: adjusted return from queries in mongodb

This commit is contained in:
Davidson Gomes 2023-12-11 12:08:58 -03:00
parent 9a5dbe055e
commit b8d9a8c072
5 changed files with 65 additions and 12 deletions

View File

@ -19,6 +19,7 @@
* Adjusts in proxy * Adjusts in proxy
* Removed api restart on receiving an error * Removed api restart on receiving an error
* Fixes in mongodb and chatwoot * Fixes in mongodb and chatwoot
* Adjusted return from queries in mongodb
# 1.5.4 (2023-10-09 20:43) # 1.5.4 (2023-10-09 20:43)

View File

@ -340,7 +340,7 @@ export class InstanceController {
const settings: wa.LocalSettings = { const settings: wa.LocalSettings = {
reject_call: reject_call || false, reject_call: reject_call || false,
msg_call: msg_call || '', msg_call: msg_call || '',
groups_ignore: groups_ignore || false, groups_ignore: groups_ignore || true,
always_online: always_online || false, always_online: always_online || false,
read_messages: read_messages || false, read_messages: read_messages || false,
read_status: read_status || false, read_status: read_status || false,

View File

@ -19,6 +19,7 @@ export class SettingsController {
public async findSettings(instance: InstanceDto) { public async findSettings(instance: InstanceDto) {
logger.verbose('requested findSettings from ' + instance.instanceName + ' instance'); logger.verbose('requested findSettings from ' + instance.instanceName + ' instance');
return this.settingsService.find(instance); const settings = this.settingsService.find(instance);
return settings;
} }
} }

View File

@ -26,7 +26,7 @@ export class SettingsService {
return result; return result;
} catch (error) { } catch (error) {
return { reject_call: false, msg_call: '', groups_ignore: false }; return { reject_call: false, msg_call: '', groups_ignore: true };
} }
} }
} }

View File

@ -304,7 +304,14 @@ export class WAStartupService {
this.logger.verbose(`Webhook url: ${data.url}`); this.logger.verbose(`Webhook url: ${data.url}`);
this.logger.verbose(`Webhook events: ${data.events}`); this.logger.verbose(`Webhook events: ${data.events}`);
return data;
return {
enabled: data.enabled,
url: data.url,
events: data.events,
webhook_by_events: data.webhook_by_events,
webhook_base64: data.webhook_base64,
};
} }
private async loadChatwoot() { private async loadChatwoot() {
@ -372,7 +379,16 @@ export class WAStartupService {
this.logger.verbose(`Chatwoot reopen conversation: ${data.reopen_conversation}`); this.logger.verbose(`Chatwoot reopen conversation: ${data.reopen_conversation}`);
this.logger.verbose(`Chatwoot conversation pending: ${data.conversation_pending}`); this.logger.verbose(`Chatwoot conversation pending: ${data.conversation_pending}`);
return data; return {
enabled: data.enabled,
account_id: data.account_id,
token: data.token,
url: data.url,
name_inbox: data.name_inbox,
sign_msg: data.sign_msg,
reopen_conversation: data.reopen_conversation,
conversation_pending: data.conversation_pending,
};
} }
private async loadSettings() { private async loadSettings() {
@ -429,7 +445,14 @@ export class WAStartupService {
this.logger.verbose(`Settings always_online: ${data.always_online}`); this.logger.verbose(`Settings always_online: ${data.always_online}`);
this.logger.verbose(`Settings read_messages: ${data.read_messages}`); this.logger.verbose(`Settings read_messages: ${data.read_messages}`);
this.logger.verbose(`Settings read_status: ${data.read_status}`); this.logger.verbose(`Settings read_status: ${data.read_status}`);
return data; return {
reject_call: data.reject_call,
msg_call: data.msg_call,
groups_ignore: data.groups_ignore,
always_online: data.always_online,
read_messages: data.read_messages,
read_status: data.read_status,
};
} }
private async loadWebsocket() { private async loadWebsocket() {
@ -463,7 +486,10 @@ export class WAStartupService {
} }
this.logger.verbose(`Websocket events: ${data.events}`); this.logger.verbose(`Websocket events: ${data.events}`);
return data; return {
enabled: data.enabled,
events: data.events,
};
} }
private async loadRabbitmq() { private async loadRabbitmq() {
@ -497,7 +523,10 @@ export class WAStartupService {
} }
this.logger.verbose(`Rabbitmq events: ${data.events}`); this.logger.verbose(`Rabbitmq events: ${data.events}`);
return data; return {
enabled: data.enabled,
events: data.events,
};
} }
public async removeRabbitmqQueues() { public async removeRabbitmqQueues() {
@ -539,7 +568,10 @@ export class WAStartupService {
} }
this.logger.verbose(`Sqs events: ${data.events}`); this.logger.verbose(`Sqs events: ${data.events}`);
return data; return {
enabled: data.enabled,
events: data.events,
};
} }
public async removeSqsQueues() { public async removeSqsQueues() {
@ -605,7 +637,17 @@ export class WAStartupService {
throw new NotFoundException('Typebot not found'); throw new NotFoundException('Typebot not found');
} }
return data; return {
enabled: data.enabled,
url: data.url,
typebot: data.typebot,
expire: data.expire,
keyword_finish: data.keyword_finish,
delay_message: data.delay_message,
unknown_message: data.unknown_message,
listening_from_me: data.listening_from_me,
sessions: data.sessions,
};
} }
private async loadProxy() { private async loadProxy() {
@ -642,7 +684,10 @@ export class WAStartupService {
throw new NotFoundException('Proxy not found'); throw new NotFoundException('Proxy not found');
} }
return data; return {
enabled: data.enabled,
proxy: data.proxy,
};
} }
private async loadChamaai() { private async loadChamaai() {
@ -688,7 +733,13 @@ export class WAStartupService {
throw new NotFoundException('Chamaai not found'); throw new NotFoundException('Chamaai not found');
} }
return data; return {
enabled: data.enabled,
url: data.url,
token: data.token,
waNumber: data.waNumber,
answerByAudio: data.answerByAudio,
};
} }
public async sendDataWebhook<T = any>(event: Events, data: T, local = true) { public async sendDataWebhook<T = any>(event: Events, data: T, local = true) {