Enhance settings and integrate Baileys controller for WhatsApp functionality

- Added `wavoipToken` field to `Setting` model in both MySQL and PostgreSQL schemas.
- Updated `package.json` and `package-lock.json` to include `mime-types` and `socket.io-client` dependencies.
- Introduced `BaileysController` and `BaileysRouter` for handling WhatsApp interactions.
- Refactored media type handling to use `mime-types` instead of `mime` across various services.
- Updated DTOs and validation schemas to accommodate the new `wavoipToken` field.
- Implemented voice call functionalities using the Wavoip service in the Baileys integration.
- Enhanced event handling in the WebSocket controller to support new features.
This commit is contained in:
Davidson Gomes
2025-01-16 11:58:33 -03:00
parent 616ae0a7eb
commit 540467293c
30 changed files with 748 additions and 36 deletions

View File

@@ -8,7 +8,7 @@ import { StorageRouter } from '@api/integrations/storage/storage.router';
import { configService } from '@config/env.config';
import { Router } from 'express';
import fs from 'fs';
import mime from 'mime';
import mimeTypes from 'mime-types';
import path from 'path';
import { CallRouter } from './call.router';
@@ -49,7 +49,7 @@ router.get('/assets/*', (req, res) => {
const filePath = path.join(basePath, 'assets/', fileName);
if (fs.existsSync(filePath)) {
res.set('Content-Type', mime.getType(filePath) || 'text/css');
res.set('Content-Type', mimeTypes.lookup(filePath) || 'text/css');
res.send(fs.readFileSync(filePath));
} else {
res.status(404).send('File not found');
@@ -87,7 +87,7 @@ router
.use('/settings', new SettingsRouter(...guards).router)
.use('/proxy', new ProxyRouter(...guards).router)
.use('/label', new LabelRouter(...guards).router)
.use('', new ChannelRouter(configService).router)
.use('', new ChannelRouter(configService, ...guards).router)
.use('', new EventRouter(configService, ...guards).router)
.use('', new ChatbotRouter(...guards).router)
.use('', new StorageRouter(...guards).router);