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,12 +227,17 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
|
|
||||||
this.client?.ws?.close();
|
this.client?.ws?.close();
|
||||||
|
|
||||||
|
const sessionExists = await this.prismaRepository.session.findFirst({
|
||||||
|
where: { sessionId: this.instanceId },
|
||||||
|
});
|
||||||
|
if (sessionExists) {
|
||||||
await this.prismaRepository.session.delete({
|
await this.prismaRepository.session.delete({
|
||||||
where: {
|
where: {
|
||||||
sessionId: this.instanceId,
|
sessionId: this.instanceId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async getProfileName() {
|
public async getProfileName() {
|
||||||
let profileName = this.client.user?.name ?? this.client.user?.verifiedName;
|
let profileName = this.client.user?.name ?? this.client.user?.verifiedName;
|
||||||
|
Loading…
Reference in New Issue
Block a user