File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments