udpate constants and references to filter groups

This commit is contained in:
Francis Cao 2025-06-24 11:09:36 -07:00
parent 5ffafc71fc
commit 657ae8ebdb
6 changed files with 39 additions and 22 deletions

View file

@ -30,17 +30,13 @@ export async function GET(
return unauthorized();
}
if (
!SESSION_COLUMNS.includes(type) &&
!EVENT_COLUMNS.includes(type) &&
!FILTER_GROUPS.includes(type)
) {
if (!SESSION_COLUMNS.includes(type) && !EVENT_COLUMNS.includes(type) && !FILTER_GROUPS[type]) {
return badRequest('Invalid type.');
}
let values;
if (FILTER_GROUPS.includes(type)) {
if (FILTER_GROUPS[type]) {
values = (await getWebsiteSegments(websiteId, type)).map(segment => ({ value: segment.name }));
} else {
values = await getValues(websiteId, FILTER_COLUMNS[type], startDate, endDate, search);