Updated filtering logic.

This commit is contained in:
Mike Cao
2024-04-02 17:06:06 -07:00
parent 6ee9bb07da
commit 810b0639c8
14 changed files with 97 additions and 83 deletions

View File

@@ -1,6 +1,6 @@
import { canViewWebsite } from 'lib/auth';
import { useAuth, useCors, useValidate } from 'lib/middleware';
import { getQueryFilters, parseDateRangeQuery } from 'lib/query';
import { getRequestFilters, getRequestDateRange } from 'lib/request';
import { NextApiRequestQueryBody, WebsitePageviews } from 'lib/types';
import { NextApiResponse } from 'next';
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
@@ -59,10 +59,10 @@ export default async (
return unauthorized(res);
}
const { startDate, endDate, unit } = await parseDateRangeQuery(req);
const { startDate, endDate, unit } = await getRequestDateRange(req);
const filters = {
...getQueryFilters(req),
...getRequestFilters(req),
startDate,
endDate,
timezone,