fix(api): harden notification task status updates

This commit is contained in:
2026-03-31 22:35:02 +02:00
parent 13be8b126b
commit 78d19c59b6
2 changed files with 121 additions and 2 deletions
@@ -131,6 +131,7 @@ export async function updateNotificationTaskStatus(
where: {
id: input.id,
OR: [{ userId }, { assigneeId: userId }],
category: { in: ["TASK", "APPROVAL"] },
},
});
@@ -146,7 +147,9 @@ export async function updateNotificationTaskStatus(
where: { id: input.id },
data: {
taskStatus: input.status,
...(isCompleting ? { completedAt: new Date(), completedBy: userId } : {}),
...(isCompleting
? { completedAt: new Date(), completedBy: userId }
: { completedAt: null, completedBy: null }),
},
});