File tree Expand file tree Collapse file tree
packages/app/control/src/services/db/payments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,18 +48,39 @@ async function listPayments(
4848 { page, page_size } : PaginationParams
4949) {
5050 const skip = page * page_size ;
51+ const fiveHoursAgo = new Date ( Date . now ( ) - 5 * 60 * 60 * 1000 ) ;
52+
53+ // Add filter to exclude pending payments older than 5 hours
54+ const enhancedWhere : Prisma . PaymentWhereInput = {
55+ ...where ,
56+ OR : [
57+ // Include all non-pending payments
58+ {
59+ status : {
60+ not : 'pending' ,
61+ } ,
62+ } ,
63+ // Include pending payments that are less than 5 hours old
64+ {
65+ status : 'pending' ,
66+ createdAt : {
67+ gte : fiveHoursAgo ,
68+ } ,
69+ } ,
70+ ] ,
71+ } ;
5172
5273 const [ payments , totalCount ] = await Promise . all ( [
5374 db . payment . findMany ( {
54- where,
75+ where : enhancedWhere ,
5576 orderBy : {
5677 createdAt : 'desc' ,
5778 } ,
5879 skip,
5980 take : page_size ,
6081 } ) ,
6182 db . payment . count ( {
62- where,
83+ where : enhancedWhere ,
6384 } ) ,
6485 ] ) ;
6586
You can’t perform that action at this time.
0 commit comments