From 9f2801d289336cc57be4e88d96f060f8199986a7 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Sat, 3 Aug 2024 13:17:02 -0300 Subject: [PATCH] Fix: Resolved issue with connecting to instance Modified: index.router.ts, whatsapp.baileys.service.ts Fixed an issue with connecting to the instance by modifying the code in index.router.ts and whatsapp.baileys.service.ts. This change resolves a critical problem that was preventing the application from connecting to the necessary instance. --- src/api/routes/index.router.ts | 6 ++++++ .../channels/whatsapp.baileys.service.ts | 20 +++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/api/routes/index.router.ts b/src/api/routes/index.router.ts index 3a668308..7edc1046 100644 --- a/src/api/routes/index.router.ts +++ b/src/api/routes/index.router.ts @@ -74,6 +74,12 @@ router documentation: `https://doc.evolution-api.com`, }); }) + .post('/verify-creds', authGuard['apikey'], async (req, res) => { + return res.status(HttpStatus.OK).json({ + status: HttpStatus.OK, + message: 'Credentials are valid', + }); + }) .use('/instance', new InstanceRouter(configService, ...guards).router) .use('/message', new MessageRouter(...guards).router) .use('/chat', new ChatRouter(...guards).router) diff --git a/src/api/services/channels/whatsapp.baileys.service.ts b/src/api/services/channels/whatsapp.baileys.service.ts index 0279043f..c113855a 100644 --- a/src/api/services/channels/whatsapp.baileys.service.ts +++ b/src/api/services/channels/whatsapp.baileys.service.ts @@ -416,16 +416,16 @@ export class BaileysStartupService extends ChannelStartupService { } } - if (connection === 'connecting') { - if (this.configService.get('DATABASE').ENABLED) { - await this.prismaRepository.instance.update({ - where: { id: this.instanceId }, - data: { - connectionStatus: 'connecting', - }, - }); - } - } + // if (connection === 'connecting') { + // if (this.configService.get('DATABASE').ENABLED) { + // await this.prismaRepository.instance.update({ + // where: { id: this.instanceId }, + // data: { + // connectionStatus: 'connecting', + // }, + // }); + // } + // } if (connection === 'open') { this.instance.wuid = this.client.user.id.replace(/:\d+/, '');