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.
This commit is contained in:
Davidson Gomes 2024-08-03 13:17:02 -03:00
parent b92a985cf8
commit 9f2801d289
2 changed files with 16 additions and 10 deletions

View File

@ -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)

View File

@ -416,16 +416,16 @@ export class BaileysStartupService extends ChannelStartupService {
}
}
if (connection === 'connecting') {
if (this.configService.get<Database>('DATABASE').ENABLED) {
await this.prismaRepository.instance.update({
where: { id: this.instanceId },
data: {
connectionStatus: 'connecting',
},
});
}
}
// if (connection === 'connecting') {
// if (this.configService.get<Database>('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+/, '');