import { type NextRequest, NextResponse } from 'next/server'; import { withAuth } from '@/lib/apiHelpers'; import { getSessionBoundaries } from '@/lib/sessions'; export const GET = withAuth(async (req: NextRequest) => { const p = req.nextUrl.searchParams; const fromVal = p.get('from'); const toVal = p.get('to'); const from = fromVal ? new Date(fromVal) : new Date(Date.now() - 86_400_000); const to = toVal ? new Date(toVal) : new Date(); const boundaries = await getSessionBoundaries(from, to); return NextResponse.json(boundaries); });