File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 11import type { ServerLoad } from '@sveltejs/kit' ;
2- import { and , eq , lte } from 'drizzle-orm' ;
2+ import { and , eq , gte } from 'drizzle-orm' ;
33import { drizzle } from 'drizzle-orm/d1' ;
44import { visitsTable } from '~/db/schema' ;
55
66const MS_PER_DAY = 24 * 60 * 60 * 1000 ;
77export const GET : ServerLoad = async ( { params, platform } ) => {
88 const duration = Number . parseInt ( params . duration ?? '' ) || 3 ;
9- const threshold = new Date ( new Date ( ) . getTime ( ) + duration * MS_PER_DAY ) ;
9+ const threshold = new Date ( new Date ( ) . getTime ( ) - duration * MS_PER_DAY ) ;
1010 const kind = params . kind ?? 'all' ;
1111
1212 if ( ! platform ) return new Response ( 'platform not found' ) ;
@@ -17,7 +17,7 @@ export const GET: ServerLoad = async ({ params, platform }) => {
1717 . where (
1818 and (
1919 eq ( visitsTable . kind , kind !== 'all' ? kind : visitsTable . kind ) ,
20- lte ( visitsTable . at , threshold )
20+ gte ( visitsTable . at , threshold )
2121 )
2222 )
2323 . all ( ) ;
You can’t perform that action at this time.
0 commit comments