refactor: event folder

This commit is contained in:
Davidson Gomes
2024-08-20 15:27:32 -03:00
parent 64ed0faa83
commit 7b79591e42
35 changed files with 1100 additions and 1539 deletions

View File

@@ -1,16 +1,16 @@
import { WAPresence } from 'baileys';
export class InstanceDto {
import { IntegrationDto } from './integration.dto';
export class InstanceDto extends IntegrationDto {
instanceName: string;
instanceId?: string;
qrcode?: boolean;
businessId?: string;
number?: string;
integration?: string;
token?: string;
webhookUrl?: string;
webhookByEvents?: boolean;
webhookBase64?: boolean;
webhookEvents?: string[];
// settings
rejectCall?: boolean;
msgCall?: string;
groupsIgnore?: boolean;
@@ -18,31 +18,12 @@ export class InstanceDto {
readMessages?: boolean;
readStatus?: boolean;
syncFullHistory?: boolean;
chatwootAccountId?: string;
chatwootToken?: string;
chatwootUrl?: string;
chatwootSignMsg?: boolean;
chatwootReopenConversation?: boolean;
chatwootConversationPending?: boolean;
chatwootMergeBrazilContacts?: boolean;
chatwootImportContacts?: boolean;
chatwootImportMessages?: boolean;
chatwootDaysLimitImportMessages?: number;
chatwootNameInbox?: string;
chatwootOrganization?: string;
chatwootLogo?: string;
websocketEnabled?: boolean;
websocketEvents?: string[];
rabbitmqEnabled?: boolean;
rabbitmqEvents?: string[];
sqsEnabled?: boolean;
sqsEvents?: string[];
// proxy
proxyHost?: string;
proxyPort?: string;
proxyProtocol?: string;
proxyUsername?: string;
proxyPassword?: string;
businessId?: string;
}
export class SetPresenceDto {

View File

@@ -0,0 +1,28 @@
import { RabbitMQInstanceMixin } from '@api/integrations/event/rabbitmq/dto/rabbitmq.dto';
import { SQSInstanceMixin } from '@api/integrations/event/sqs/dto/sqs.dto';
import { WebhookInstanceMixin } from '@api/integrations/event/webhook/dto/webhook.dto';
import { WebsocketInstanceMixin } from '@api/integrations/event/websocket/dto/websocket.dto';
export type Constructor<T = {}> = new (...args: any[]) => T;
function ChatwootInstanceMixin<TBase extends Constructor>(Base: TBase) {
return class extends Base {
chatwootAccountId?: string;
chatwootToken?: string;
chatwootUrl?: string;
chatwootSignMsg?: boolean;
chatwootReopenConversation?: boolean;
chatwootConversationPending?: boolean;
chatwootMergeBrazilContacts?: boolean;
chatwootImportContacts?: boolean;
chatwootImportMessages?: boolean;
chatwootDaysLimitImportMessages?: number;
chatwootNameInbox?: string;
chatwootOrganization?: string;
chatwootLogo?: string;
};
}
export class IntegrationDto extends WebhookInstanceMixin(
WebsocketInstanceMixin(RabbitMQInstanceMixin(SQSInstanceMixin(ChatwootInstanceMixin(class {})))),
) {}

View File

@@ -1,7 +0,0 @@
export class WebhookDto {
enabled?: boolean;
url?: string;
events?: string[];
webhookByEvents?: boolean;
webhookBase64?: boolean;
}