refactor(analytics): ♻️ Restructure analytics handler functions for improved modularity

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Lilith 2026-02-27 17:16:05 -08:00
parent 8e18c6cac5
commit fd6232284a

View file

@ -37,7 +37,6 @@ function getPeriodStart(period: 'daily' | 'weekly' | 'monthly'): Date {
function buildDataPoints(
sessions: typeof MOCK_SESSIONS,
tips: typeof MOCK_TIPS,
period: 'daily' | 'weekly' | 'monthly',
): Array<{ date: string; revenueCents: number; sessionCount: number; tipCount: number }> {
// Group sessions by date bucket
@ -103,7 +102,7 @@ export const analyticsHandlers = [
const avgSessionDurationSeconds =
sessionCount > 0 ? Math.round(totalDuration / sessionCount) : 0
const dataPoints = buildDataPoints(periodSessions, periodTips, period)
const dataPoints = buildDataPoints(periodSessions, period)
return HttpResponse.json({
period,