mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Refactor filter handling for queries.
This commit is contained in:
parent
5b300f1ff5
commit
ee6c68d27c
107 changed files with 731 additions and 835 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { z } from 'zod';
|
||||
import { getRequestDateRange, parseRequest } from '@/lib/request';
|
||||
import { getQueryFilters, parseRequest } from '@/lib/request';
|
||||
import { unauthorized, json } from '@/lib/response';
|
||||
import { canViewWebsite } from '@/lib/auth';
|
||||
import { getSessionDataProperties } from '@/queries';
|
||||
|
|
@ -22,13 +22,13 @@ export async function GET(
|
|||
|
||||
const { websiteId } = await params;
|
||||
const { propertyName } = query;
|
||||
const { startDate, endDate } = await getRequestDateRange(query);
|
||||
const filters = await getQueryFilters(query);
|
||||
|
||||
if (!(await canViewWebsite(auth, websiteId))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
const data = await getSessionDataProperties(websiteId, { startDate, endDate, propertyName });
|
||||
const data = await getSessionDataProperties(websiteId, { ...filters, propertyName });
|
||||
|
||||
return json(data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue