mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-11 10:27:01 +02:00
fix: delete all shares of reverse share
This commit is contained in:
@@ -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 } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user