FRE-622: Wire analytics services to tRPC API layer with comprehensive router

Create analytics-router.ts with ~30 tRPC endpoints for KPI management, alert
rules, scheduled reports, cohort analysis, and NPS survey integration.
Register router in index.ts under 'analytics' namespace. Fix pre-existing
bugs in service files: snake_case to camelCase conversion, missing non-null
assertions, and incorrect DB access patterns.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Paperclip Agent
2026-04-27 22:55:15 -04:00
committed by Michael Freno
parent bc897f8845
commit 408d94f731
6 changed files with 461 additions and 20 deletions

View File

@@ -178,7 +178,7 @@ export async function createScheduledReport(
lastRunAt: null,
nextRunAt: computeNextRun(input.schedule),
}).returning();
return result[0];
return result[0]!;
}
export async function getActiveScheduledReports(