Update compare parameter to use enum for valid values

This commit is contained in:
AymanAlSuleihi committed 2026-01-09 23:41:16 +00:00
1 parent 6420f2c813
commit a049fbb5b0
2 files changed
+2 -2

No files matched your search

@@ -31,7 +31,7 @@ export async function GET(
const data = await getWebsiteStats(websiteId, filters);
const compare = filters.compare === 'yoy' ? 'yoy' : 'prev';
const compare = filters.compare ?? 'prev';
const { startDate, endDate } = getCompareDate(compare, filters.startDate, filters.endDate);
+1 -1
View File
@@ -20,7 +20,7 @@ export const dateRangeParams = {
endDate: z.coerce.date().optional(),
timezone: timezoneParam.optional(),
unit: unitParam.optional(),
compare: z.string().optional(),
compare: z.enum(['prev', 'yoy']).optional(),
};
export const filterParams = {