fix: soft delete a document when the owner deletes it

This commit is contained in:
Ephraim Atta-Duncan
2024-06-17 22:20:42 +00:00
committed by Mythie
parent 26ccdc1b23
commit 2837b178fb
3 changed files with 74 additions and 20 deletions

View File

@ -138,6 +138,16 @@ const handleDocumentOwnerDelete = async ({
}),
});
// Soft delete for document recipients since the owner is deleting it
await tx.recipient.updateMany({
where: {
documentId: document.id,
},
data: {
documentDeletedAt: new Date().toISOString(),
},
});
return await tx.document.update({
where: {
id: document.id,