1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-06-30 06:30:11 +02:00

fix: delete all shares of reverse share

This commit is contained in:
Elias Schneider 2023-02-10 11:15:23 +01:00
parent ccdf8ea3ae
commit 86a7379519
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C

View File

@ -81,15 +81,15 @@ export class ReverseShareService {
}
async remove(id: string) {
const share = await this.prisma.share.findFirst({
const shares = await this.prisma.share.findMany({
where: { reverseShare: { id } },
});
if (share) {
for (const share of shares) {
await this.prisma.share.delete({ where: { id: share.id } });
await this.fileService.deleteAllFiles(share.id);
} else {
await this.prisma.reverseShare.delete({ where: { id } });
}
await this.prisma.reverseShare.delete({ where: { id } });
}
}