From 6420f2c81338705d1ad83295fb5b53dcfb8aa8b1 Mon Sep 17 00:00:00 2001 From: AymanAlSuleihi Date: Fri, 9 Jan 2026 22:54:50 +0000 Subject: [PATCH] Remove redundant compare param definition --- src/app/api/websites/[websiteId]/stats/route.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/app/api/websites/[websiteId]/stats/route.ts b/src/app/api/websites/[websiteId]/stats/route.ts index 09d691f1..12492537 100644 --- a/src/app/api/websites/[websiteId]/stats/route.ts +++ b/src/app/api/websites/[websiteId]/stats/route.ts @@ -12,7 +12,6 @@ export async function GET( ) { const schema = z.object({ ...dateRangeParams, - compare: z.enum(['prev', 'yoy']).optional(), ...filterParams, }); @@ -32,11 +31,9 @@ export async function GET( const data = await getWebsiteStats(websiteId, filters); - const { startDate, endDate } = getCompareDate( - filters.compare || 'prev', - filters.startDate, - filters.endDate, - ); + const compare = filters.compare === 'yoy' ? 'yoy' : 'prev'; + + const { startDate, endDate } = getCompareDate(compare, filters.startDate, filters.endDate); const comparison = await getWebsiteStats(websiteId, { ...filters,