mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Use getRequestDateRange in all routes.
This commit is contained in:
parent
b0023feee9
commit
5171bdaf47
21 changed files with 72 additions and 173 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { z } from 'zod';
|
||||
import { parseRequest } from '@/lib/request';
|
||||
import { getRequestDateRange, parseRequest } from '@/lib/request';
|
||||
import { unauthorized, json } from '@/lib/response';
|
||||
import { canViewWebsite } from '@/lib/auth';
|
||||
import { getSessionDataProperties } from '@/queries';
|
||||
|
|
@ -20,16 +20,14 @@ export async function GET(
|
|||
return error();
|
||||
}
|
||||
|
||||
const { startAt, endAt, propertyName } = query;
|
||||
const { websiteId } = await params;
|
||||
const { propertyName } = query;
|
||||
const { startDate, endDate } = await getRequestDateRange(query);
|
||||
|
||||
if (!(await canViewWebsite(auth, websiteId))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
const startDate = new Date(+startAt);
|
||||
const endDate = new Date(+endAt);
|
||||
|
||||
const data = await getSessionDataProperties(websiteId, { startDate, endDate, propertyName });
|
||||
|
||||
return json(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue