mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-15 01:14:27 -05:00
fix: delete all shares of reverse share
This commit is contained in:
parent
ccdf8ea3ae
commit
86a7379519
1 changed files with 4 additions and 4 deletions
|
@ -81,15 +81,15 @@ export class ReverseShareService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove(id: string) {
|
async remove(id: string) {
|
||||||
const share = await this.prisma.share.findFirst({
|
const shares = await this.prisma.share.findMany({
|
||||||
where: { reverseShare: { id } },
|
where: { reverseShare: { id } },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (share) {
|
for (const share of shares) {
|
||||||
await this.prisma.share.delete({ where: { id: share.id } });
|
await this.prisma.share.delete({ where: { id: share.id } });
|
||||||
await this.fileService.deleteAllFiles(share.id);
|
await this.fileService.deleteAllFiles(share.id);
|
||||||
} else {
|
|
||||||
await this.prisma.reverseShare.delete({ where: { id } });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.prisma.reverseShare.delete({ where: { id } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue