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

@@ -5,6 +5,8 @@ import { scriptsRouter } from './scripts-router';
import { waitlistRouter } from './waitlist-router';
import { betaRouter } from './beta-router';
import { mailRouter } from './mail-router';
import { teamRouter } from './team-router';
import { analyticsRouter } from './analytics-router';
import type { TRPCContext } from './types';
import type { TRPCError } from '@trpc/server';
import { t } from './router';
@@ -17,6 +19,8 @@ export const appRouter = t.router({
waitlist: waitlistRouter,
beta: betaRouter,
mail: mailRouter,
team: teamRouter,
analytics: analyticsRouter,
} as const);
export type AppRouter = typeof appRouter;