mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-20 10:16:43 -06:00
Validate if session exists before deleting it
This commit is contained in:
parent
feb7b795e9
commit
668f477218
@ -227,11 +227,16 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
this.client?.ws?.close();
|
||||
|
||||
await this.prismaRepository.session.delete({
|
||||
where: {
|
||||
sessionId: this.instanceId,
|
||||
},
|
||||
const sessionExists = await this.prismaRepository.session.findFirst({
|
||||
where: { sessionId: this.instanceId },
|
||||
});
|
||||
if (sessionExists) {
|
||||
await this.prismaRepository.session.delete({
|
||||
where: {
|
||||
sessionId: this.instanceId,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public async getProfileName() {
|
||||
|
Loading…
Reference in New Issue
Block a user