From 94f5c130bf5f8631ec4e1a79a14dcd42f99045e5 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Fri, 12 Apr 2024 17:22:11 -0300 Subject: [PATCH] fix: reorganization of files and folders --- .../controllers/chamaai.controller.ts | 4 +-- .../chamaai}/dto/chamaai.dto.ts | 0 .../chamaai}/models/chamaai.model.ts | 2 +- .../chamaai}/repository/chamaai.repository.ts | 8 ++--- .../chamaai/routes}/chamaai.router.ts | 12 +++---- .../chamaai}/services/chamaai.service.ts | 12 +++---- .../chamaai/validate/chamaai.schema.ts | 35 +++++++++++++++++++ .../chatwoot/routes/chatwoot.router.ts | 2 +- .../rabbitmq/routes/rabbitmq.router.ts | 2 +- src/api/integrations/sqs/routes/sqs.router.ts | 2 +- .../typebot/routes/typebot.router.ts | 2 +- .../websocket/routes/websocket.router.ts | 2 +- src/api/models/index.ts | 2 +- src/api/repository/repository.manager.ts | 2 +- src/api/{routers => routes}/chat.router.ts | 0 src/api/{routers => routes}/group.router.ts | 0 src/api/{routers => routes}/index.router.ts | 2 +- .../{routers => routes}/instance.router.ts | 0 src/api/{routers => routes}/label.router.ts | 0 src/api/{routers => routes}/proxy.router.ts | 0 .../{routers => routes}/sendMessage.router.ts | 0 .../{routers => routes}/settings.router.ts | 0 src/api/{routers => routes}/view.router.ts | 0 src/api/{routers => routes}/webhook.router.ts | 0 src/api/server.module.ts | 6 ++-- src/api/services/whatsapp.service.ts | 2 +- src/exceptions/400.exception.ts | 2 +- src/exceptions/401.exception.ts | 2 +- src/exceptions/403.exception.ts | 2 +- src/exceptions/404.exception.ts | 2 +- src/exceptions/500.exception.ts | 2 +- src/main.ts | 2 +- src/validate/validate.schema.ts | 15 +------- 33 files changed, 73 insertions(+), 51 deletions(-) rename src/api/{ => integrations/chamaai}/controllers/chamaai.controller.ts (88%) rename src/api/{ => integrations/chamaai}/dto/chamaai.dto.ts (100%) rename src/api/{ => integrations/chamaai}/models/chamaai.model.ts (91%) rename src/api/{ => integrations/chamaai}/repository/chamaai.repository.ts (87%) rename src/api/{routers => integrations/chamaai/routes}/chamaai.router.ts (79%) rename src/api/{ => integrations/chamaai}/services/chamaai.service.ts (94%) create mode 100644 src/api/integrations/chamaai/validate/chamaai.schema.ts rename src/api/{routers => routes}/chat.router.ts (100%) rename src/api/{routers => routes}/group.router.ts (100%) rename src/api/{routers => routes}/index.router.ts (97%) rename src/api/{routers => routes}/instance.router.ts (100%) rename src/api/{routers => routes}/label.router.ts (100%) rename src/api/{routers => routes}/proxy.router.ts (100%) rename src/api/{routers => routes}/sendMessage.router.ts (100%) rename src/api/{routers => routes}/settings.router.ts (100%) rename src/api/{routers => routes}/view.router.ts (100%) rename src/api/{routers => routes}/webhook.router.ts (100%) diff --git a/src/api/controllers/chamaai.controller.ts b/src/api/integrations/chamaai/controllers/chamaai.controller.ts similarity index 88% rename from src/api/controllers/chamaai.controller.ts rename to src/api/integrations/chamaai/controllers/chamaai.controller.ts index e9cafb504..91b33cd1f 100644 --- a/src/api/controllers/chamaai.controller.ts +++ b/src/api/integrations/chamaai/controllers/chamaai.controller.ts @@ -1,6 +1,6 @@ -import { Logger } from '../../config/logger.config'; +import { Logger } from '../../../../config/logger.config'; +import { InstanceDto } from '../../../dto/instance.dto'; import { ChamaaiDto } from '../dto/chamaai.dto'; -import { InstanceDto } from '../dto/instance.dto'; import { ChamaaiService } from '../services/chamaai.service'; const logger = new Logger('ChamaaiController'); diff --git a/src/api/dto/chamaai.dto.ts b/src/api/integrations/chamaai/dto/chamaai.dto.ts similarity index 100% rename from src/api/dto/chamaai.dto.ts rename to src/api/integrations/chamaai/dto/chamaai.dto.ts diff --git a/src/api/models/chamaai.model.ts b/src/api/integrations/chamaai/models/chamaai.model.ts similarity index 91% rename from src/api/models/chamaai.model.ts rename to src/api/integrations/chamaai/models/chamaai.model.ts index d3d10aff5..ef4f252bc 100644 --- a/src/api/models/chamaai.model.ts +++ b/src/api/integrations/chamaai/models/chamaai.model.ts @@ -1,6 +1,6 @@ import { Schema } from 'mongoose'; -import { dbserver } from '../../libs/db.connect'; +import { dbserver } from '../../../../libs/db.connect'; export class ChamaaiRaw { _id?: string; diff --git a/src/api/repository/chamaai.repository.ts b/src/api/integrations/chamaai/repository/chamaai.repository.ts similarity index 87% rename from src/api/repository/chamaai.repository.ts rename to src/api/integrations/chamaai/repository/chamaai.repository.ts index a2009f419..17ff8dcd8 100644 --- a/src/api/repository/chamaai.repository.ts +++ b/src/api/integrations/chamaai/repository/chamaai.repository.ts @@ -1,10 +1,10 @@ import { readFileSync } from 'fs'; import { join } from 'path'; -import { ConfigService } from '../../config/env.config'; -import { Logger } from '../../config/logger.config'; -import { IInsert, Repository } from '../abstract/abstract.repository'; -import { ChamaaiRaw, IChamaaiModel } from '../models'; +import { ConfigService } from '../../../../config/env.config'; +import { Logger } from '../../../../config/logger.config'; +import { IInsert, Repository } from '../../../abstract/abstract.repository'; +import { ChamaaiRaw, IChamaaiModel } from '../../../models'; export class ChamaaiRepository extends Repository { constructor(private readonly chamaaiModel: IChamaaiModel, private readonly configService: ConfigService) { diff --git a/src/api/routers/chamaai.router.ts b/src/api/integrations/chamaai/routes/chamaai.router.ts similarity index 79% rename from src/api/routers/chamaai.router.ts rename to src/api/integrations/chamaai/routes/chamaai.router.ts index 93644af36..3ade4b435 100644 --- a/src/api/routers/chamaai.router.ts +++ b/src/api/integrations/chamaai/routes/chamaai.router.ts @@ -1,12 +1,12 @@ import { RequestHandler, Router } from 'express'; -import { Logger } from '../../config/logger.config'; -import { chamaaiSchema, instanceNameSchema } from '../../validate/validate.schema'; -import { RouterBroker } from '../abstract/abstract.router'; +import { Logger } from '../../../../config/logger.config'; +import { chamaaiSchema, instanceNameSchema } from '../../../../validate/validate.schema'; +import { RouterBroker } from '../../../abstract/abstract.router'; +import { InstanceDto } from '../../../dto/instance.dto'; +import { HttpStatus } from '../../../routes/index.router'; +import { chamaaiController } from '../../../server.module'; import { ChamaaiDto } from '../dto/chamaai.dto'; -import { InstanceDto } from '../dto/instance.dto'; -import { chamaaiController } from '../server.module'; -import { HttpStatus } from './index.router'; const logger = new Logger('ChamaaiRouter'); diff --git a/src/api/services/chamaai.service.ts b/src/api/integrations/chamaai/services/chamaai.service.ts similarity index 94% rename from src/api/services/chamaai.service.ts rename to src/api/integrations/chamaai/services/chamaai.service.ts index ad2a42ad9..911732a84 100644 --- a/src/api/services/chamaai.service.ts +++ b/src/api/integrations/chamaai/services/chamaai.service.ts @@ -2,13 +2,13 @@ import axios from 'axios'; import { writeFileSync } from 'fs'; import path from 'path'; -import { ConfigService, HttpServer } from '../../config/env.config'; -import { Logger } from '../../config/logger.config'; +import { ConfigService, HttpServer } from '../../../../config/env.config'; +import { Logger } from '../../../../config/logger.config'; +import { InstanceDto } from '../../../dto/instance.dto'; +import { ChamaaiRaw } from '../../../models'; +import { WAMonitoringService } from '../../../services/monitor.service'; +import { Events } from '../../../types/wa.types'; import { ChamaaiDto } from '../dto/chamaai.dto'; -import { InstanceDto } from '../dto/instance.dto'; -import { ChamaaiRaw } from '../models'; -import { Events } from '../types/wa.types'; -import { WAMonitoringService } from './monitor.service'; export class ChamaaiService { constructor(private readonly waMonitor: WAMonitoringService, private readonly configService: ConfigService) {} diff --git a/src/api/integrations/chamaai/validate/chamaai.schema.ts b/src/api/integrations/chamaai/validate/chamaai.schema.ts new file mode 100644 index 000000000..0b80104f3 --- /dev/null +++ b/src/api/integrations/chamaai/validate/chamaai.schema.ts @@ -0,0 +1,35 @@ +import { JSONSchema7 } from 'json-schema'; +import { v4 } from 'uuid'; + +const isNotEmpty = (...propertyNames: string[]): JSONSchema7 => { + const properties = {}; + propertyNames.forEach( + (property) => + (properties[property] = { + minLength: 1, + description: `The "${property}" cannot be empty`, + }), + ); + return { + if: { + propertyNames: { + enum: [...propertyNames], + }, + }, + then: { properties }, + }; +}; + +export const chamaaiSchema: JSONSchema7 = { + $id: v4(), + type: 'object', + properties: { + enabled: { type: 'boolean', enum: [true, false] }, + url: { type: 'string' }, + token: { type: 'string' }, + waNumber: { type: 'string' }, + answerByAudio: { type: 'boolean', enum: [true, false] }, + }, + required: ['enabled', 'url', 'token', 'waNumber', 'answerByAudio'], + ...isNotEmpty('enabled', 'url', 'token', 'waNumber', 'answerByAudio'), +}; diff --git a/src/api/integrations/chatwoot/routes/chatwoot.router.ts b/src/api/integrations/chatwoot/routes/chatwoot.router.ts index 2df2f18f9..cc2271632 100644 --- a/src/api/integrations/chatwoot/routes/chatwoot.router.ts +++ b/src/api/integrations/chatwoot/routes/chatwoot.router.ts @@ -4,7 +4,7 @@ import { Logger } from '../../../../config/logger.config'; import { chatwootSchema, instanceNameSchema } from '../../../../validate/validate.schema'; import { RouterBroker } from '../../../abstract/abstract.router'; import { InstanceDto } from '../../../dto/instance.dto'; -import { HttpStatus } from '../../../routers/index.router'; +import { HttpStatus } from '../../../routes/index.router'; import { chatwootController } from '../../../server.module'; import { ChatwootDto } from '../dto/chatwoot.dto'; diff --git a/src/api/integrations/rabbitmq/routes/rabbitmq.router.ts b/src/api/integrations/rabbitmq/routes/rabbitmq.router.ts index c7d567e15..a477a5baf 100644 --- a/src/api/integrations/rabbitmq/routes/rabbitmq.router.ts +++ b/src/api/integrations/rabbitmq/routes/rabbitmq.router.ts @@ -4,7 +4,7 @@ import { Logger } from '../../../../config/logger.config'; import { instanceNameSchema, rabbitmqSchema } from '../../../../validate/validate.schema'; import { RouterBroker } from '../../../abstract/abstract.router'; import { InstanceDto } from '../../../dto/instance.dto'; -import { HttpStatus } from '../../../routers/index.router'; +import { HttpStatus } from '../../../routes/index.router'; import { rabbitmqController } from '../../../server.module'; import { RabbitmqDto } from '../dto/rabbitmq.dto'; diff --git a/src/api/integrations/sqs/routes/sqs.router.ts b/src/api/integrations/sqs/routes/sqs.router.ts index 8b03bb3a3..80d148386 100644 --- a/src/api/integrations/sqs/routes/sqs.router.ts +++ b/src/api/integrations/sqs/routes/sqs.router.ts @@ -4,7 +4,7 @@ import { Logger } from '../../../../config/logger.config'; import { instanceNameSchema, sqsSchema } from '../../../../validate/validate.schema'; import { RouterBroker } from '../../../abstract/abstract.router'; import { InstanceDto } from '../../../dto/instance.dto'; -import { HttpStatus } from '../../../routers/index.router'; +import { HttpStatus } from '../../../routes/index.router'; import { sqsController } from '../../../server.module'; import { SqsDto } from '../dto/sqs.dto'; diff --git a/src/api/integrations/typebot/routes/typebot.router.ts b/src/api/integrations/typebot/routes/typebot.router.ts index b9694c540..2eed2b393 100644 --- a/src/api/integrations/typebot/routes/typebot.router.ts +++ b/src/api/integrations/typebot/routes/typebot.router.ts @@ -9,7 +9,7 @@ import { } from '../../../../validate/validate.schema'; import { RouterBroker } from '../../../abstract/abstract.router'; import { InstanceDto } from '../../../dto/instance.dto'; -import { HttpStatus } from '../../../routers/index.router'; +import { HttpStatus } from '../../../routes/index.router'; import { typebotController } from '../../../server.module'; import { TypebotDto } from '../dto/typebot.dto'; diff --git a/src/api/integrations/websocket/routes/websocket.router.ts b/src/api/integrations/websocket/routes/websocket.router.ts index 271c1ce2c..0c39d53ce 100644 --- a/src/api/integrations/websocket/routes/websocket.router.ts +++ b/src/api/integrations/websocket/routes/websocket.router.ts @@ -4,7 +4,7 @@ import { Logger } from '../../../../config/logger.config'; import { instanceNameSchema, websocketSchema } from '../../../../validate/validate.schema'; import { RouterBroker } from '../../../abstract/abstract.router'; import { InstanceDto } from '../../../dto/instance.dto'; -import { HttpStatus } from '../../../routers/index.router'; +import { HttpStatus } from '../../../routes/index.router'; import { websocketController } from '../../../server.module'; import { WebsocketDto } from '../dto/websocket.dto'; diff --git a/src/api/models/index.ts b/src/api/models/index.ts index 6cec09a93..42399bc5a 100644 --- a/src/api/models/index.ts +++ b/src/api/models/index.ts @@ -1,10 +1,10 @@ +export * from '../integrations/chamaai/models/chamaai.model'; export * from '../integrations/chatwoot/models/chatwoot.model'; export * from '../integrations/rabbitmq/models/rabbitmq.model'; export * from '../integrations/sqs/models/sqs.model'; export * from '../integrations/typebot/models/typebot.model'; export * from '../integrations/websocket/models/websocket.model'; export * from './auth.model'; -export * from './chamaai.model'; export * from './chat.model'; export * from './contact.model'; export * from './integration.model'; diff --git a/src/api/repository/repository.manager.ts b/src/api/repository/repository.manager.ts index 2ea54aa11..5fd9e55e1 100644 --- a/src/api/repository/repository.manager.ts +++ b/src/api/repository/repository.manager.ts @@ -4,13 +4,13 @@ import { join } from 'path'; import { Auth, ConfigService, Database } from '../../config/env.config'; import { Logger } from '../../config/logger.config'; +import { ChamaaiRepository } from '../integrations/chamaai/repository/chamaai.repository'; import { ChatwootRepository } from '../integrations/chatwoot/repository/chatwoot.repository'; import { RabbitmqRepository } from '../integrations/rabbitmq/repository/rabbitmq.repository'; import { SqsRepository } from '../integrations/sqs/repository/sqs.repository'; import { TypebotRepository } from '../integrations/typebot/repository/typebot.repository'; import { WebsocketRepository } from '../integrations/websocket/repository/websocket.repository'; import { AuthRepository } from './auth.repository'; -import { ChamaaiRepository } from './chamaai.repository'; import { ChatRepository } from './chat.repository'; import { ContactRepository } from './contact.repository'; import { IntegrationRepository } from './integration.repository'; diff --git a/src/api/routers/chat.router.ts b/src/api/routes/chat.router.ts similarity index 100% rename from src/api/routers/chat.router.ts rename to src/api/routes/chat.router.ts diff --git a/src/api/routers/group.router.ts b/src/api/routes/group.router.ts similarity index 100% rename from src/api/routers/group.router.ts rename to src/api/routes/group.router.ts diff --git a/src/api/routers/index.router.ts b/src/api/routes/index.router.ts similarity index 97% rename from src/api/routers/index.router.ts rename to src/api/routes/index.router.ts index 8d17ab6fb..3b26671fc 100644 --- a/src/api/routers/index.router.ts +++ b/src/api/routes/index.router.ts @@ -4,12 +4,12 @@ import fs from 'fs'; import { Auth, configService } from '../../config/env.config'; import { authGuard } from '../guards/auth.guard'; import { instanceExistsGuard, instanceLoggedGuard } from '../guards/instance.guard'; +import { ChamaaiRouter } from '../integrations/chamaai/routes/chamaai.router'; import { ChatwootRouter } from '../integrations/chatwoot/routes/chatwoot.router'; import { RabbitmqRouter } from '../integrations/rabbitmq/routes/rabbitmq.router'; import { SqsRouter } from '../integrations/sqs/routes/sqs.router'; import { TypebotRouter } from '../integrations/typebot/routes/typebot.router'; import { WebsocketRouter } from '../integrations/websocket/routes/websocket.router'; -import { ChamaaiRouter } from './chamaai.router'; import { ChatRouter } from './chat.router'; import { GroupRouter } from './group.router'; import { InstanceRouter } from './instance.router'; diff --git a/src/api/routers/instance.router.ts b/src/api/routes/instance.router.ts similarity index 100% rename from src/api/routers/instance.router.ts rename to src/api/routes/instance.router.ts diff --git a/src/api/routers/label.router.ts b/src/api/routes/label.router.ts similarity index 100% rename from src/api/routers/label.router.ts rename to src/api/routes/label.router.ts diff --git a/src/api/routers/proxy.router.ts b/src/api/routes/proxy.router.ts similarity index 100% rename from src/api/routers/proxy.router.ts rename to src/api/routes/proxy.router.ts diff --git a/src/api/routers/sendMessage.router.ts b/src/api/routes/sendMessage.router.ts similarity index 100% rename from src/api/routers/sendMessage.router.ts rename to src/api/routes/sendMessage.router.ts diff --git a/src/api/routers/settings.router.ts b/src/api/routes/settings.router.ts similarity index 100% rename from src/api/routers/settings.router.ts rename to src/api/routes/settings.router.ts diff --git a/src/api/routers/view.router.ts b/src/api/routes/view.router.ts similarity index 100% rename from src/api/routers/view.router.ts rename to src/api/routes/view.router.ts diff --git a/src/api/routers/webhook.router.ts b/src/api/routes/webhook.router.ts similarity index 100% rename from src/api/routers/webhook.router.ts rename to src/api/routes/webhook.router.ts diff --git a/src/api/server.module.ts b/src/api/server.module.ts index 67512cac9..6c72aaf51 100644 --- a/src/api/server.module.ts +++ b/src/api/server.module.ts @@ -3,7 +3,6 @@ import { eventEmitter } from '../config/event.config'; import { Logger } from '../config/logger.config'; import { dbserver } from '../libs/db.connect'; import { RedisCache } from '../libs/redis.client'; -import { ChamaaiController } from './controllers/chamaai.controller'; import { ChatController } from './controllers/chat.controller'; import { GroupController } from './controllers/group.controller'; import { InstanceController } from './controllers/instance.controller'; @@ -12,6 +11,9 @@ import { ProxyController } from './controllers/proxy.controller'; import { SendMessageController } from './controllers/sendMessage.controller'; import { SettingsController } from './controllers/settings.controller'; import { WebhookController } from './controllers/webhook.controller'; +import { ChamaaiController } from './integrations/chamaai/controllers/chamaai.controller'; +import { ChamaaiRepository } from './integrations/chamaai/repository/chamaai.repository'; +import { ChamaaiService } from './integrations/chamaai/services/chamaai.service'; import { CacheEngine } from './integrations/chatwoot/cache/cacheengine'; import { ChatwootController } from './integrations/chatwoot/controllers/chatwoot.controller'; import { ChatwootRepository } from './integrations/chatwoot/repository/chatwoot.repository'; @@ -47,7 +49,6 @@ import { } from './models'; import { LabelModel } from './models/label.model'; import { AuthRepository } from './repository/auth.repository'; -import { ChamaaiRepository } from './repository/chamaai.repository'; import { ChatRepository } from './repository/chat.repository'; import { ContactRepository } from './repository/contact.repository'; import { IntegrationRepository } from './repository/integration.repository'; @@ -60,7 +61,6 @@ import { SettingsRepository } from './repository/settings.repository'; import { WebhookRepository } from './repository/webhook.repository'; import { AuthService } from './services/auth.service'; import { CacheService } from './services/cache.service'; -import { ChamaaiService } from './services/chamaai.service'; import { IntegrationService } from './services/integration.service'; import { WAMonitoringService } from './services/monitor.service'; import { ProxyService } from './services/proxy.service'; diff --git a/src/api/services/whatsapp.service.ts b/src/api/services/whatsapp.service.ts index b9cece5a6..5c6df8d3e 100644 --- a/src/api/services/whatsapp.service.ts +++ b/src/api/services/whatsapp.service.ts @@ -20,6 +20,7 @@ import { import { Logger } from '../../config/logger.config'; import { ROOT_DIR } from '../../config/path.config'; import { NotFoundException } from '../../exceptions'; +import { ChamaaiService } from '../integrations/chamaai/services/chamaai.service'; import { ChatwootRaw } from '../integrations/chatwoot/models/chatwoot.model'; import { ChatwootService } from '../integrations/chatwoot/services/chatwoot.service'; import { getAMQP, removeQueues } from '../integrations/rabbitmq/libs/amqp.server'; @@ -36,7 +37,6 @@ import { RepositoryBroker } from '../repository/repository.manager'; import { waMonitor } from '../server.module'; import { Events, wa } from '../types/wa.types'; import { CacheService } from './cache.service'; -import { ChamaaiService } from './chamaai.service'; export class WAStartupService { constructor( diff --git a/src/exceptions/400.exception.ts b/src/exceptions/400.exception.ts index 6697aeb24..2ea3a7a41 100644 --- a/src/exceptions/400.exception.ts +++ b/src/exceptions/400.exception.ts @@ -1,4 +1,4 @@ -import { HttpStatus } from '../api/routers/index.router'; +import { HttpStatus } from '../api/routes/index.router'; export class BadRequestException { constructor(...objectError: any[]) { diff --git a/src/exceptions/401.exception.ts b/src/exceptions/401.exception.ts index 8fd72da27..f5383e0eb 100644 --- a/src/exceptions/401.exception.ts +++ b/src/exceptions/401.exception.ts @@ -1,4 +1,4 @@ -import { HttpStatus } from '../api/routers/index.router'; +import { HttpStatus } from '../api/routes/index.router'; export class UnauthorizedException { constructor(...objectError: any[]) { diff --git a/src/exceptions/403.exception.ts b/src/exceptions/403.exception.ts index a7c118bd3..53d8f05c6 100644 --- a/src/exceptions/403.exception.ts +++ b/src/exceptions/403.exception.ts @@ -1,4 +1,4 @@ -import { HttpStatus } from '../api/routers/index.router'; +import { HttpStatus } from '../api/routes/index.router'; export class ForbiddenException { constructor(...objectError: any[]) { diff --git a/src/exceptions/404.exception.ts b/src/exceptions/404.exception.ts index 6c06f095c..f2fd5c28d 100644 --- a/src/exceptions/404.exception.ts +++ b/src/exceptions/404.exception.ts @@ -1,4 +1,4 @@ -import { HttpStatus } from '../api/routers/index.router'; +import { HttpStatus } from '../api/routes/index.router'; export class NotFoundException { constructor(...objectError: any[]) { diff --git a/src/exceptions/500.exception.ts b/src/exceptions/500.exception.ts index 445f240b0..c5111f6d7 100644 --- a/src/exceptions/500.exception.ts +++ b/src/exceptions/500.exception.ts @@ -1,4 +1,4 @@ -import { HttpStatus } from '../api/routers/index.router'; +import { HttpStatus } from '../api/routes/index.router'; export class InternalServerErrorException { constructor(...objectError: any[]) { diff --git a/src/main.ts b/src/main.ts index 49a3d153e..942c725f4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,7 +9,7 @@ import { join } from 'path'; import { initAMQP } from './api/integrations/rabbitmq/libs/amqp.server'; import { initSQS } from './api/integrations/sqs/libs/sqs.server'; import { initIO } from './api/integrations/websocket/libs/socket.server'; -import { HttpStatus, router } from './api/routers/index.router'; +import { HttpStatus, router } from './api/routes/index.router'; import { waMonitor } from './api/server.module'; import { Auth, configService, Cors, HttpServer, Rabbitmq, Sqs, Webhook } from './config/env.config'; import { onUnexpectedError } from './config/error.config'; diff --git a/src/validate/validate.schema.ts b/src/validate/validate.schema.ts index 6bafb9b9a..9013ca39f 100644 --- a/src/validate/validate.schema.ts +++ b/src/validate/validate.schema.ts @@ -2,6 +2,7 @@ import { JSONSchema7, JSONSchema7Definition } from 'json-schema'; import { v4 } from 'uuid'; // Integrations Schema +export * from '../api/integrations/chamaai/validate/chamaai.schema'; export * from '../api/integrations/chatwoot/validate/chatwoot.schema'; export * from '../api/integrations/rabbitmq/validate/rabbitmq.schema'; export * from '../api/integrations/sqs/validate/sqs.schema'; @@ -1046,20 +1047,6 @@ export const proxySchema: JSONSchema7 = { ...isNotEmpty('enabled', 'proxy'), }; -export const chamaaiSchema: JSONSchema7 = { - $id: v4(), - type: 'object', - properties: { - enabled: { type: 'boolean', enum: [true, false] }, - url: { type: 'string' }, - token: { type: 'string' }, - waNumber: { type: 'string' }, - answerByAudio: { type: 'boolean', enum: [true, false] }, - }, - required: ['enabled', 'url', 'token', 'waNumber', 'answerByAudio'], - ...isNotEmpty('enabled', 'url', 'token', 'waNumber', 'answerByAudio'), -}; - export const handleLabelSchema: JSONSchema7 = { $id: v4(), type: 'object',