mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 04:12:23 -06:00
feat: prisma and remove mongodb
This commit is contained in:
@@ -2,8 +2,6 @@ import { CacheEngine } from '../cache/cacheengine';
|
||||
import { configService } from '../config/env.config';
|
||||
import { eventEmitter } from '../config/event.config';
|
||||
import { Logger } from '../config/logger.config';
|
||||
import { mongodbServer } from '../libs/mongodb.connect';
|
||||
import { prismaServer } from '../libs/prisma.connect';
|
||||
import { ChatController } from './controllers/chat.controller';
|
||||
import { GroupController } from './controllers/group.controller';
|
||||
import { InstanceController } from './controllers/instance.controller';
|
||||
@@ -13,50 +11,17 @@ import { SendMessageController } from './controllers/sendMessage.controller';
|
||||
import { SettingsController } from './controllers/settings.controller';
|
||||
import { WebhookController } from './controllers/webhook.controller';
|
||||
import { ChatwootController } from './integrations/chatwoot/controllers/chatwoot.controller';
|
||||
import { ChatwootRepository } from './integrations/chatwoot/repository/chatwoot.repository';
|
||||
import { ChatwootService } from './integrations/chatwoot/services/chatwoot.service';
|
||||
import { RabbitmqController } from './integrations/rabbitmq/controllers/rabbitmq.controller';
|
||||
import { RabbitmqRepository } from './integrations/rabbitmq/repository/rabbitmq.repository';
|
||||
import { RabbitmqService } from './integrations/rabbitmq/services/rabbitmq.service';
|
||||
import { SqsController } from './integrations/sqs/controllers/sqs.controller';
|
||||
import { SqsRepository } from './integrations/sqs/repository/sqs.repository';
|
||||
import { SqsService } from './integrations/sqs/services/sqs.service';
|
||||
import { TypebotController } from './integrations/typebot/controllers/typebot.controller';
|
||||
import { TypebotRepository } from './integrations/typebot/repository/typebot.repository';
|
||||
import { TypebotService } from './integrations/typebot/services/typebot.service';
|
||||
import { WebsocketController } from './integrations/websocket/controllers/websocket.controller';
|
||||
import { WebsocketRepository } from './integrations/websocket/repository/websocket.repository';
|
||||
import { WebsocketService } from './integrations/websocket/services/websocket.service';
|
||||
import {
|
||||
AuthModel,
|
||||
ChatModel,
|
||||
ChatwootModel,
|
||||
ContactModel,
|
||||
IntegrationModel,
|
||||
MessageModel,
|
||||
MessageUpModel,
|
||||
ProxyModel,
|
||||
RabbitmqModel,
|
||||
SettingsModel,
|
||||
SqsModel,
|
||||
TypebotModel,
|
||||
WebhookModel,
|
||||
WebsocketModel,
|
||||
} from './models';
|
||||
import { LabelModel } from './models/label.model';
|
||||
import { ProviderFiles } from './provider/sessions';
|
||||
import { AuthRepository } from './repository/mongodb/auth.repository';
|
||||
import { ChatRepository } from './repository/mongodb/chat.repository';
|
||||
import { ContactRepository } from './repository/mongodb/contact.repository';
|
||||
import { IntegrationRepository } from './repository/mongodb/integration.repository';
|
||||
import { LabelRepository } from './repository/mongodb/label.repository';
|
||||
import { MessageRepository } from './repository/mongodb/message.repository';
|
||||
import { MessageUpRepository } from './repository/mongodb/messageUp.repository';
|
||||
import { ProxyRepository } from './repository/mongodb/proxy.repository';
|
||||
import { MongodbRepository } from './repository/mongodb/repository.manager';
|
||||
import { SettingsRepository } from './repository/mongodb/settings.repository';
|
||||
import { WebhookRepository } from './repository/mongodb/webhook.repository';
|
||||
import { PrismaRepository } from './repository/prisma/repository.service';
|
||||
import { PrismaRepository } from './repository/repository.service';
|
||||
import { AuthService } from './services/auth.service';
|
||||
import { CacheService } from './services/cache.service';
|
||||
import { IntegrationService } from './services/integration.service';
|
||||
@@ -67,62 +32,24 @@ import { WebhookService } from './services/webhook.service';
|
||||
|
||||
const logger = new Logger('WA MODULE');
|
||||
|
||||
const messageRepository = new MessageRepository(MessageModel, configService);
|
||||
const chatRepository = new ChatRepository(ChatModel, configService);
|
||||
const contactRepository = new ContactRepository(ContactModel, configService);
|
||||
const messageUpdateRepository = new MessageUpRepository(MessageUpModel, configService);
|
||||
const typebotRepository = new TypebotRepository(TypebotModel, configService);
|
||||
const webhookRepository = new WebhookRepository(WebhookModel, configService);
|
||||
const websocketRepository = new WebsocketRepository(WebsocketModel, configService);
|
||||
const proxyRepository = new ProxyRepository(ProxyModel, configService);
|
||||
const rabbitmqRepository = new RabbitmqRepository(RabbitmqModel, configService);
|
||||
const sqsRepository = new SqsRepository(SqsModel, configService);
|
||||
const integrationRepository = new IntegrationRepository(IntegrationModel, configService);
|
||||
const chatwootRepository = new ChatwootRepository(ChatwootModel, configService);
|
||||
const settingsRepository = new SettingsRepository(SettingsModel, configService);
|
||||
const authRepository = new AuthRepository(AuthModel, IntegrationModel, configService);
|
||||
const labelRepository = new LabelRepository(LabelModel, configService);
|
||||
|
||||
export const mongodbRepository = new MongodbRepository(
|
||||
messageRepository,
|
||||
chatRepository,
|
||||
contactRepository,
|
||||
messageUpdateRepository,
|
||||
webhookRepository,
|
||||
chatwootRepository,
|
||||
settingsRepository,
|
||||
websocketRepository,
|
||||
rabbitmqRepository,
|
||||
sqsRepository,
|
||||
typebotRepository,
|
||||
proxyRepository,
|
||||
integrationRepository,
|
||||
authRepository,
|
||||
labelRepository,
|
||||
configService,
|
||||
mongodbServer.getClient(),
|
||||
prismaServer,
|
||||
);
|
||||
|
||||
export const prismaRepository = new PrismaRepository(configService);
|
||||
|
||||
export const cache = new CacheService(new CacheEngine(configService, 'instance').getEngine());
|
||||
const chatwootCache = new CacheService(new CacheEngine(configService, ChatwootService.name).getEngine());
|
||||
const baileysCache = new CacheService(new CacheEngine(configService, 'baileys').getEngine());
|
||||
|
||||
const providerFiles = new ProviderFiles(configService);
|
||||
export const prismaRepository = new PrismaRepository(configService);
|
||||
|
||||
export const waMonitor = new WAMonitoringService(
|
||||
eventEmitter,
|
||||
configService,
|
||||
mongodbRepository,
|
||||
prismaRepository,
|
||||
providerFiles,
|
||||
cache,
|
||||
chatwootCache,
|
||||
baileysCache,
|
||||
providerFiles,
|
||||
);
|
||||
|
||||
const authService = new AuthService(waMonitor, mongodbRepository, prismaRepository);
|
||||
const authService = new AuthService(waMonitor, configService, prismaRepository);
|
||||
|
||||
const typebotService = new TypebotService(waMonitor, configService, eventEmitter);
|
||||
export const typebotController = new TypebotController(typebotService);
|
||||
@@ -144,19 +71,8 @@ export const sqsController = new SqsController(sqsService);
|
||||
|
||||
const integrationService = new IntegrationService(waMonitor);
|
||||
|
||||
const chatwootService = new ChatwootService(
|
||||
waMonitor,
|
||||
configService,
|
||||
mongodbRepository,
|
||||
prismaRepository,
|
||||
chatwootCache,
|
||||
);
|
||||
export const chatwootController = new ChatwootController(
|
||||
chatwootService,
|
||||
configService,
|
||||
mongodbRepository,
|
||||
prismaRepository,
|
||||
);
|
||||
const chatwootService = new ChatwootService(waMonitor, configService, prismaRepository, chatwootCache);
|
||||
export const chatwootController = new ChatwootController(chatwootService, configService, prismaRepository);
|
||||
|
||||
const settingsService = new SettingsService(waMonitor);
|
||||
export const settingsController = new SettingsController(settingsService);
|
||||
@@ -164,7 +80,6 @@ export const settingsController = new SettingsController(settingsService);
|
||||
export const instanceController = new InstanceController(
|
||||
waMonitor,
|
||||
configService,
|
||||
mongodbRepository,
|
||||
prismaRepository,
|
||||
eventEmitter,
|
||||
authService,
|
||||
|
||||
Reference in New Issue
Block a user