@@ -11,10 +11,11 @@ export function notifications(users: Hono<{ Bindings: Environment }>, services:
1111 users . get ( '/:addressOrENS/notifications' , includeValidator , async context => {
1212 const { addressOrENS } = context . req . param ( )
1313 const { cache } = context . req . query ( )
14- let { offset, limit, opcode, interval, tag } = context . req . valid ( 'query' )
14+ let { offset, limit, opcode, start , interval, tag } = context . req . valid ( 'query' )
1515 if ( ! limit ) limit = '10'
1616 if ( ! offset ) offset = '0'
1717 if ( ! ( opcode && [ 1 , 2 , 3 , 4 ] . includes ( Number ( opcode ) ) ) ) opcode = '0'
18+ if ( ! start || start === '' ) start = Math . floor ( Date . now ( ) / 1000 ) . toString ( )
1819 if ( ! tag || tag === '' ) tag = 'p_tag_empty'
1920 if ( interval === 'hour' ) interval = '1:00:00'
2021 else if ( interval === 'day' ) interval = '24:00:00'
@@ -24,7 +25,7 @@ export function notifications(users: Hono<{ Bindings: Environment }>, services:
2425 else interval = '168:00:00'
2526
2627 const cacheService = services . cache ( env ( context ) )
27- const cacheTarget = `users/${ addressOrENS } /notifications?opcode=${ opcode } &interval=${ interval } &tag=${ tag } &limit=${ limit } &offset=${ offset } `
28+ const cacheTarget = `users/${ addressOrENS } /notifications?opcode=${ opcode } &start= ${ start } & interval=${ interval } &tag=${ tag } &limit=${ limit } &offset=${ offset } `
2829
2930 if ( cache !== 'fresh' ) {
3031 const cacheHit = await cacheService . get ( cacheTarget )
@@ -41,7 +42,15 @@ export function notifications(users: Hono<{ Bindings: Environment }>, services:
4142
4243 const notifications : NotificationRow [ ] = await services
4344 . efp ( env ( context ) )
44- . getNotificationsByAddress ( address , opcode as string , interval , tag as string , limit as string , offset as string )
45+ . getNotificationsByAddress (
46+ address ,
47+ opcode as string ,
48+ BigInt ( start as string ) ,
49+ interval ,
50+ tag as string ,
51+ limit as string ,
52+ offset as string
53+ )
4554
4655 const response = notifications . map ( notification => {
4756 return {
0 commit comments