Skip to content

Commit 7f5bb4d

Browse files
committed
Coderabbit fix 2
1 parent a1aaa28 commit 7f5bb4d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

apps/web/lib/api/fraud/resolve-fraud-groups.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function resolveFraudGroups({
3131
};
3232
}
3333

34-
const resolvedAt = new Date();
34+
const resolvedAtLowerBound = new Date();
3535

3636
const { count } = await tx.fraudEventGroup.updateMany({
3737
where: {
@@ -43,7 +43,7 @@ export async function resolveFraudGroups({
4343
data: {
4444
userId,
4545
resolutionReason,
46-
resolvedAt,
46+
resolvedAt: resolvedAtLowerBound,
4747
status: "resolved",
4848
},
4949
});
@@ -55,14 +55,20 @@ export async function resolveFraudGroups({
5555
};
5656
}
5757

58+
const resolvedAtUpperBound = new Date();
59+
5860
// In case of concurrent updates, only return groups that were updated in this call.
5961
const resolvedGroups = await tx.fraudEventGroup.findMany({
6062
where: {
6163
id: {
6264
in: pendingGroupIds,
6365
},
6466
status: "resolved",
65-
resolvedAt,
67+
resolvedAt: {
68+
gte: resolvedAtLowerBound,
69+
lte: resolvedAtUpperBound,
70+
},
71+
...(userId ? { userId } : {}),
6672
},
6773
select: {
6874
id: true,

0 commit comments

Comments
 (0)