fix(api): harden notification task status updates
This commit is contained in:
@@ -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 }),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user