mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 12:22:21 -06:00
Merge pull request #750 from judsonjuniorr/v2-path-mappings
V2 Path mapping & deps fix & bundler changed to tsup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { BadRequestException } from '../../exceptions';
|
||||
import { PrismaRepository } from '../repository/repository.service';
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { BadRequestException } from '@exceptions';
|
||||
|
||||
export class AuthService {
|
||||
constructor(private readonly prismaRepository: PrismaRepository) {}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { ICache } from '@api/abstract/abstract.cache';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { BufferJSON } from 'baileys';
|
||||
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { ICache } from '../abstract/abstract.cache';
|
||||
|
||||
export class CacheService {
|
||||
private readonly logger = new Logger(CacheService.name);
|
||||
private readonly logger = new Logger('CacheService');
|
||||
|
||||
constructor(private readonly cache: ICache) {
|
||||
if (cache) {
|
||||
|
||||
@@ -1,3 +1,25 @@
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { ProxyDto } from '@api/dto/proxy.dto';
|
||||
import { SettingsDto } from '@api/dto/settings.dto';
|
||||
import { WebhookDto } from '@api/dto/webhook.dto';
|
||||
import { ChatwootDto } from '@api/integrations/chatwoot/dto/chatwoot.dto';
|
||||
import { ChatwootService } from '@api/integrations/chatwoot/services/chatwoot.service';
|
||||
import { DifyService } from '@api/integrations/dify/services/dify.service';
|
||||
import { OpenaiService } from '@api/integrations/openai/services/openai.service';
|
||||
import { RabbitmqDto } from '@api/integrations/rabbitmq/dto/rabbitmq.dto';
|
||||
import { getAMQP, removeQueues } from '@api/integrations/rabbitmq/libs/amqp.server';
|
||||
import { SqsDto } from '@api/integrations/sqs/dto/sqs.dto';
|
||||
import { getSQS, removeQueues as removeQueuesSQS } from '@api/integrations/sqs/libs/sqs.server';
|
||||
import { TypebotService } from '@api/integrations/typebot/services/typebot.service';
|
||||
import { WebsocketDto } from '@api/integrations/websocket/dto/websocket.dto';
|
||||
import { getIO } from '@api/integrations/websocket/libs/socket.server';
|
||||
import { PrismaRepository, Query } from '@api/repository/repository.service';
|
||||
import { waMonitor } from '@api/server.module';
|
||||
import { Events, wa } from '@api/types/wa.types';
|
||||
import { Auth, Chatwoot, ConfigService, HttpServer, Log, Rabbitmq, Sqs, Webhook, Websocket } from '@config/env.config';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { ROOT_DIR } from '@config/path.config';
|
||||
import { NotFoundException } from '@exceptions';
|
||||
import { Contact, Message } from '@prisma/client';
|
||||
import axios from 'axios';
|
||||
import { WASocket } from 'baileys';
|
||||
@@ -6,38 +28,6 @@ import EventEmitter2 from 'eventemitter2';
|
||||
import { join } from 'path';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import {
|
||||
Auth,
|
||||
Chatwoot,
|
||||
ConfigService,
|
||||
HttpServer,
|
||||
Log,
|
||||
Rabbitmq,
|
||||
Sqs,
|
||||
Webhook,
|
||||
Websocket,
|
||||
} from '../../config/env.config';
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { ROOT_DIR } from '../../config/path.config';
|
||||
import { NotFoundException } from '../../exceptions';
|
||||
import { InstanceDto } from '../dto/instance.dto';
|
||||
import { ProxyDto } from '../dto/proxy.dto';
|
||||
import { SettingsDto } from '../dto/settings.dto';
|
||||
import { WebhookDto } from '../dto/webhook.dto';
|
||||
import { ChatwootDto } from '../integrations/chatwoot/dto/chatwoot.dto';
|
||||
import { ChatwootService } from '../integrations/chatwoot/services/chatwoot.service';
|
||||
import { DifyService } from '../integrations/dify/services/dify.service';
|
||||
import { OpenaiService } from '../integrations/openai/services/openai.service';
|
||||
import { RabbitmqDto } from '../integrations/rabbitmq/dto/rabbitmq.dto';
|
||||
import { getAMQP, removeQueues } from '../integrations/rabbitmq/libs/amqp.server';
|
||||
import { SqsDto } from '../integrations/sqs/dto/sqs.dto';
|
||||
import { getSQS, removeQueues as removeQueuesSQS } from '../integrations/sqs/libs/sqs.server';
|
||||
import { TypebotService } from '../integrations/typebot/services/typebot.service';
|
||||
import { WebsocketDto } from '../integrations/websocket/dto/websocket.dto';
|
||||
import { getIO } from '../integrations/websocket/libs/socket.server';
|
||||
import { PrismaRepository, Query } from '../repository/repository.service';
|
||||
import { waMonitor } from '../server.module';
|
||||
import { Events, wa } from '../types/wa.types';
|
||||
import { CacheService } from './cache.service';
|
||||
|
||||
export class ChannelStartupService {
|
||||
@@ -48,7 +38,7 @@ export class ChannelStartupService {
|
||||
public readonly chatwootCache: CacheService,
|
||||
) {}
|
||||
|
||||
public readonly logger = new Logger(ChannelStartupService.name);
|
||||
public readonly logger = new Logger('ChannelStartupService');
|
||||
|
||||
public client: WASocket;
|
||||
public readonly instance: wa.Instance = {};
|
||||
|
||||
@@ -1,6 +1,83 @@
|
||||
import {
|
||||
ArchiveChatDto,
|
||||
BlockUserDto,
|
||||
DeleteMessage,
|
||||
getBase64FromMediaMessageDto,
|
||||
LastMessage,
|
||||
MarkChatUnreadDto,
|
||||
NumberBusiness,
|
||||
OnWhatsAppDto,
|
||||
PrivacySettingDto,
|
||||
ReadMessageDto,
|
||||
SendPresenceDto,
|
||||
UpdateMessageDto,
|
||||
WhatsAppNumberDto,
|
||||
} from '@api/dto/chat.dto';
|
||||
import {
|
||||
AcceptGroupInvite,
|
||||
CreateGroupDto,
|
||||
GetParticipant,
|
||||
GroupDescriptionDto,
|
||||
GroupInvite,
|
||||
GroupJid,
|
||||
GroupPictureDto,
|
||||
GroupSendInvite,
|
||||
GroupSubjectDto,
|
||||
GroupToggleEphemeralDto,
|
||||
GroupUpdateParticipantDto,
|
||||
GroupUpdateSettingDto,
|
||||
} from '@api/dto/group.dto';
|
||||
import { InstanceDto, SetPresenceDto } from '@api/dto/instance.dto';
|
||||
import { HandleLabelDto, LabelDto } from '@api/dto/label.dto';
|
||||
import {
|
||||
ContactMessage,
|
||||
MediaMessage,
|
||||
Options,
|
||||
SendAudioDto,
|
||||
SendContactDto,
|
||||
SendListDto,
|
||||
SendLocationDto,
|
||||
SendMediaDto,
|
||||
SendPollDto,
|
||||
SendReactionDto,
|
||||
SendStatusDto,
|
||||
SendStickerDto,
|
||||
SendTextDto,
|
||||
StatusMessage,
|
||||
} from '@api/dto/sendMessage.dto';
|
||||
import { chatwootImport } from '@api/integrations/chatwoot/utils/chatwoot-import-helper';
|
||||
import * as s3Service from '@api/integrations/s3/libs/minio.server';
|
||||
import { ProviderFiles } from '@api/provider/sessions';
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { waMonitor } from '@api/server.module';
|
||||
import { CacheService } from '@api/services/cache.service';
|
||||
import { ChannelStartupService } from '@api/services/channel.service';
|
||||
import { Events, MessageSubtype, TypeMediaMessage, wa } from '@api/types/wa.types';
|
||||
import { CacheEngine } from '@cache/cacheengine';
|
||||
import {
|
||||
CacheConf,
|
||||
Chatwoot,
|
||||
ConfigService,
|
||||
configService,
|
||||
ConfigSessionPhone,
|
||||
Database,
|
||||
Dify,
|
||||
Log,
|
||||
Openai,
|
||||
ProviderSession,
|
||||
QrCode,
|
||||
S3,
|
||||
Typebot,
|
||||
} from '@config/env.config';
|
||||
import { INSTANCE_DIR } from '@config/path.config';
|
||||
import { BadRequestException, InternalServerErrorException, NotFoundException } from '@exceptions';
|
||||
import ffmpegPath from '@ffmpeg-installer/ffmpeg';
|
||||
import { Boom } from '@hapi/boom';
|
||||
import { Instance } from '@prisma/client';
|
||||
import { makeProxyAgent } from '@utils/makeProxyAgent';
|
||||
import useMultiFileAuthStatePrisma from '@utils/use-multi-file-auth-state-prisma';
|
||||
import { AuthStateProvider } from '@utils/use-multi-file-auth-state-provider-files';
|
||||
import { useMultiFileAuthStateRedisDb } from '@utils/use-multi-file-auth-state-redis-db';
|
||||
import axios from 'axios';
|
||||
import makeWASocket, {
|
||||
AnyMessageContent,
|
||||
@@ -49,7 +126,6 @@ import { existsSync, readFileSync } from 'fs';
|
||||
import Long from 'long';
|
||||
import mime from 'mime';
|
||||
import NodeCache from 'node-cache';
|
||||
import { getMIMEType } from 'node-mime-types';
|
||||
import { release } from 'os';
|
||||
import { join } from 'path';
|
||||
import P from 'pino';
|
||||
@@ -59,84 +135,6 @@ import sharp from 'sharp';
|
||||
import { PassThrough } from 'stream';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { CacheEngine } from '../../../cache/cacheengine';
|
||||
import {
|
||||
CacheConf,
|
||||
Chatwoot,
|
||||
ConfigService,
|
||||
configService,
|
||||
ConfigSessionPhone,
|
||||
Database,
|
||||
Dify,
|
||||
Log,
|
||||
Openai,
|
||||
ProviderSession,
|
||||
QrCode,
|
||||
S3,
|
||||
Typebot,
|
||||
} from '../../../config/env.config';
|
||||
import { INSTANCE_DIR } from '../../../config/path.config';
|
||||
import { BadRequestException, InternalServerErrorException, NotFoundException } from '../../../exceptions';
|
||||
import { makeProxyAgent } from '../../../utils/makeProxyAgent';
|
||||
import useMultiFileAuthStatePrisma from '../../../utils/use-multi-file-auth-state-prisma';
|
||||
import { AuthStateProvider } from '../../../utils/use-multi-file-auth-state-provider-files';
|
||||
import { useMultiFileAuthStateRedisDb } from '../../../utils/use-multi-file-auth-state-redis-db';
|
||||
import {
|
||||
ArchiveChatDto,
|
||||
BlockUserDto,
|
||||
DeleteMessage,
|
||||
getBase64FromMediaMessageDto,
|
||||
LastMessage,
|
||||
MarkChatUnreadDto,
|
||||
NumberBusiness,
|
||||
OnWhatsAppDto,
|
||||
PrivacySettingDto,
|
||||
ReadMessageDto,
|
||||
SendPresenceDto,
|
||||
UpdateMessageDto,
|
||||
WhatsAppNumberDto,
|
||||
} from '../../dto/chat.dto';
|
||||
import {
|
||||
AcceptGroupInvite,
|
||||
CreateGroupDto,
|
||||
GetParticipant,
|
||||
GroupDescriptionDto,
|
||||
GroupInvite,
|
||||
GroupJid,
|
||||
GroupPictureDto,
|
||||
GroupSendInvite,
|
||||
GroupSubjectDto,
|
||||
GroupToggleEphemeralDto,
|
||||
GroupUpdateParticipantDto,
|
||||
GroupUpdateSettingDto,
|
||||
} from '../../dto/group.dto';
|
||||
import { InstanceDto, SetPresenceDto } from '../../dto/instance.dto';
|
||||
import { HandleLabelDto, LabelDto } from '../../dto/label.dto';
|
||||
import {
|
||||
ContactMessage,
|
||||
MediaMessage,
|
||||
Options,
|
||||
SendAudioDto,
|
||||
SendContactDto,
|
||||
SendListDto,
|
||||
SendLocationDto,
|
||||
SendMediaDto,
|
||||
SendPollDto,
|
||||
SendReactionDto,
|
||||
SendStatusDto,
|
||||
SendStickerDto,
|
||||
SendTextDto,
|
||||
StatusMessage,
|
||||
} from '../../dto/sendMessage.dto';
|
||||
import { chatwootImport } from '../../integrations/chatwoot/utils/chatwoot-import-helper';
|
||||
import * as s3Service from '../../integrations/s3/libs/minio.server';
|
||||
import { ProviderFiles } from '../../provider/sessions';
|
||||
import { PrismaRepository } from '../../repository/repository.service';
|
||||
import { waMonitor } from '../../server.module';
|
||||
import { Events, MessageSubtype, TypeMediaMessage, wa } from '../../types/wa.types';
|
||||
import { CacheService } from './../cache.service';
|
||||
import { ChannelStartupService } from './../channel.service';
|
||||
|
||||
const groupMetadataCache = new CacheService(new CacheEngine(configService, 'groups').getEngine());
|
||||
|
||||
export class BaileysStartupService extends ChannelStartupService {
|
||||
@@ -1015,7 +1013,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
await this.contactHandle['contacts.upsert'](
|
||||
contacts
|
||||
.filter((c) => !!c.notify ?? !!c.name)
|
||||
.filter((c) => !!c.notify || !!c.name)
|
||||
.map((c) => ({
|
||||
id: c.id,
|
||||
name: c.name ?? c.notify,
|
||||
@@ -1156,7 +1154,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
const { buffer, mediaType, fileName, size } = media;
|
||||
|
||||
const mimetype = mime.lookup(fileName).toString();
|
||||
const mimetype = mime.getType(fileName).toString();
|
||||
|
||||
const fullName = join(`${this.instance.id}`, received.key.remoteJid, mediaType, fileName);
|
||||
|
||||
@@ -2319,7 +2317,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
if (mediaMessage.mimetype) {
|
||||
mimetype = mediaMessage.mimetype;
|
||||
} else {
|
||||
mimetype = getMIMEType(mediaMessage.fileName);
|
||||
mimetype = mime.getType(mediaMessage.fileName);
|
||||
|
||||
if (!mimetype && isURL(mediaMessage.media)) {
|
||||
let config: any = {
|
||||
@@ -2983,7 +2981,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
);
|
||||
const typeMessage = getContentType(msg.message);
|
||||
|
||||
const ext = mime.extension(mediaMessage?.['mimetype']);
|
||||
const ext = mime.getExtension(mediaMessage?.['mimetype']);
|
||||
|
||||
const fileName = mediaMessage?.['fileName'] || `${msg.key.id}.${ext}` || `${v4()}.${ext}`;
|
||||
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
import axios from 'axios';
|
||||
import { arrayUnique, isURL } from 'class-validator';
|
||||
import EventEmitter2 from 'eventemitter2';
|
||||
import FormData from 'form-data';
|
||||
import { createReadStream } from 'fs';
|
||||
import { getMIMEType } from 'node-mime-types';
|
||||
import { join } from 'path';
|
||||
|
||||
import { Chatwoot, ConfigService, Database, Dify, Openai, S3, Typebot, WaBusiness } from '../../../config/env.config';
|
||||
import { BadRequestException, InternalServerErrorException } from '../../../exceptions';
|
||||
import { NumberBusiness } from '../../dto/chat.dto';
|
||||
import { NumberBusiness } from '@api/dto/chat.dto';
|
||||
import {
|
||||
ContactMessage,
|
||||
MediaMessage,
|
||||
@@ -22,13 +12,22 @@ import {
|
||||
SendReactionDto,
|
||||
SendTemplateDto,
|
||||
SendTextDto,
|
||||
} from '../../dto/sendMessage.dto';
|
||||
import * as s3Service from '../../integrations/s3/libs/minio.server';
|
||||
import { ProviderFiles } from '../../provider/sessions';
|
||||
import { PrismaRepository } from '../../repository/repository.service';
|
||||
import { Events, wa } from '../../types/wa.types';
|
||||
import { CacheService } from './../cache.service';
|
||||
import { ChannelStartupService } from './../channel.service';
|
||||
} from '@api/dto/sendMessage.dto';
|
||||
import * as s3Service from '@api/integrations/s3/libs/minio.server';
|
||||
import { ProviderFiles } from '@api/provider/sessions';
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { CacheService } from '@api/services/cache.service';
|
||||
import { ChannelStartupService } from '@api/services/channel.service';
|
||||
import { Events, wa } from '@api/types/wa.types';
|
||||
import { Chatwoot, ConfigService, Database, Dify, Openai, S3, Typebot, WaBusiness } from '@config/env.config';
|
||||
import { BadRequestException, InternalServerErrorException } from '@exceptions';
|
||||
import axios from 'axios';
|
||||
import { arrayUnique, isURL } from 'class-validator';
|
||||
import EventEmitter2 from 'eventemitter2';
|
||||
import FormData from 'form-data';
|
||||
import { createReadStream } from 'fs';
|
||||
import mime from 'mime';
|
||||
import { join } from 'path';
|
||||
|
||||
export class BusinessStartupService extends ChannelStartupService {
|
||||
constructor(
|
||||
@@ -1059,11 +1058,11 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
};
|
||||
|
||||
if (isURL(mediaMessage.media)) {
|
||||
mimetype = getMIMEType(mediaMessage.media);
|
||||
mimetype = mime.getType(mediaMessage.media);
|
||||
prepareMedia.id = mediaMessage.media;
|
||||
prepareMedia.type = 'link';
|
||||
} else {
|
||||
mimetype = getMIMEType(mediaMessage.fileName);
|
||||
mimetype = mime.getType(mediaMessage.fileName);
|
||||
const id = await this.getIdMedia(prepareMedia);
|
||||
prepareMedia.id = id;
|
||||
prepareMedia.type = 'id';
|
||||
@@ -1109,11 +1108,11 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
};
|
||||
|
||||
if (isURL(audio)) {
|
||||
mimetype = getMIMEType(audio);
|
||||
mimetype = mime.getType(audio);
|
||||
prepareMedia.id = audio;
|
||||
prepareMedia.type = 'link';
|
||||
} else {
|
||||
mimetype = getMIMEType(prepareMedia.fileName);
|
||||
mimetype = mime.getType(prepareMedia.fileName);
|
||||
const id = await this.getIdMedia(prepareMedia);
|
||||
prepareMedia.id = id;
|
||||
prepareMedia.type = 'id';
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { ProviderFiles } from '@api/provider/sessions';
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { Integration } from '@api/types/wa.types';
|
||||
import { CacheConf, Chatwoot, ConfigService, Database, DelInstance, ProviderSession } from '@config/env.config';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { INSTANCE_DIR, STORE_DIR } from '@config/path.config';
|
||||
import { NotFoundException } from '@exceptions';
|
||||
import { execSync } from 'child_process';
|
||||
import EventEmitter2 from 'eventemitter2';
|
||||
import { rmSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
import { CacheConf, Chatwoot, ConfigService, Database, DelInstance, ProviderSession } from '../../config/env.config';
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { INSTANCE_DIR, STORE_DIR } from '../../config/path.config';
|
||||
import { NotFoundException } from '../../exceptions';
|
||||
import { InstanceDto } from '../dto/instance.dto';
|
||||
import { ProviderFiles } from '../provider/sessions';
|
||||
import { PrismaRepository } from '../repository/repository.service';
|
||||
import { Integration } from '../types/wa.types';
|
||||
import { CacheService } from './cache.service';
|
||||
import { BaileysStartupService } from './channels/whatsapp.baileys.service';
|
||||
import { BusinessStartupService } from './channels/whatsapp.business.service';
|
||||
@@ -35,7 +35,7 @@ export class WAMonitoringService {
|
||||
private readonly db: Partial<Database> = {};
|
||||
private readonly redis: Partial<CacheConf> = {};
|
||||
|
||||
private readonly logger = new Logger(WAMonitoringService.name);
|
||||
private readonly logger = new Logger('WAMonitoringService');
|
||||
public readonly waInstances: Record<string, BaileysStartupService | BusinessStartupService> = {};
|
||||
|
||||
private readonly providerSession = Object.freeze(this.configService.get<ProviderSession>('PROVIDER'));
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { ProxyDto } from '@api/dto/proxy.dto';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { Proxy } from '@prisma/client';
|
||||
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { InstanceDto } from '../dto/instance.dto';
|
||||
import { ProxyDto } from '../dto/proxy.dto';
|
||||
import { WAMonitoringService } from './monitor.service';
|
||||
|
||||
export class ProxyService {
|
||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
||||
|
||||
private readonly logger = new Logger(ProxyService.name);
|
||||
private readonly logger = new Logger('ProxyService');
|
||||
|
||||
public create(instance: InstanceDto, data: ProxyDto) {
|
||||
this.waMonitor.waInstances[instance.instanceName].setProxy(data);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { InstanceDto } from '../dto/instance.dto';
|
||||
import { SettingsDto } from '../dto/settings.dto';
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { SettingsDto } from '@api/dto/settings.dto';
|
||||
import { Logger } from '@config/logger.config';
|
||||
|
||||
import { WAMonitoringService } from './monitor.service';
|
||||
|
||||
export class SettingsService {
|
||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
||||
|
||||
private readonly logger = new Logger(SettingsService.name);
|
||||
private readonly logger = new Logger('SettingsService');
|
||||
|
||||
public async create(instance: InstanceDto, data: SettingsDto) {
|
||||
await this.waMonitor.waInstances[instance.instanceName].setSettings(data);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { TemplateDto } from '@api/dto/template.dto';
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { ConfigService, WaBusiness } from '@config/env.config';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import axios from 'axios';
|
||||
|
||||
import { ConfigService, WaBusiness } from '../../config/env.config';
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { InstanceDto } from '../dto/instance.dto';
|
||||
import { TemplateDto } from '../dto/template.dto';
|
||||
import { PrismaRepository } from '../repository/repository.service';
|
||||
import { WAMonitoringService } from './monitor.service';
|
||||
|
||||
export class TemplateService {
|
||||
@@ -14,7 +14,7 @@ export class TemplateService {
|
||||
private readonly configService: ConfigService,
|
||||
) {}
|
||||
|
||||
private readonly logger = new Logger(TemplateService.name);
|
||||
private readonly logger = new Logger('TemplateService');
|
||||
|
||||
private businessId: string;
|
||||
private token: string;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { WebhookDto } from '@api/dto/webhook.dto';
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { Webhook } from '@prisma/client';
|
||||
import axios from 'axios';
|
||||
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { InstanceDto } from '../dto/instance.dto';
|
||||
import { WebhookDto } from '../dto/webhook.dto';
|
||||
import { PrismaRepository } from '../repository/repository.service';
|
||||
import { WAMonitoringService } from './monitor.service';
|
||||
|
||||
export class WebhookService {
|
||||
constructor(private readonly waMonitor: WAMonitoringService, public readonly prismaRepository: PrismaRepository) {}
|
||||
|
||||
private readonly logger = new Logger(WebhookService.name);
|
||||
private readonly logger = new Logger('WebhookService');
|
||||
|
||||
public create(instance: InstanceDto, data: WebhookDto) {
|
||||
this.waMonitor.waInstances[instance.instanceName].setWebhook(data);
|
||||
|
||||
Reference in New Issue
Block a user