Initial web
This commit is contained in:
11
web/app/api/sessions/route.ts
Normal file
11
web/app/api/sessions/route.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { getSessionBoundaries } from '@/lib/sessions';
|
||||
import { withAuth } from '@/lib/apiHelpers';
|
||||
|
||||
export const GET = withAuth(async (req: NextRequest) => {
|
||||
const p = req.nextUrl.searchParams;
|
||||
const from = p.get('from') ? new Date(p.get('from')!) : new Date(Date.now() - 86_400_000);
|
||||
const to = p.get('to') ? new Date(p.get('to')!) : new Date();
|
||||
const boundaries = await getSessionBoundaries(from, to);
|
||||
return NextResponse.json(boundaries);
|
||||
});
|
||||
Reference in New Issue
Block a user