INNER CODE UNIT · TypeScript
getEventTopLevelStats
rehanvdm/serverless-website-analytics · application/src/backend/api-front/routes/stats/event/index.ts:34
export function getEventTopLevelStats(trpcInstance: TrpcInstance) {
return trpcInstance.procedure
.input(
z.object({
from: z.string().datetime(),
to: z.string().datetime(),
sites: z.array(SchemaSite),
filter: EventFilterSchema.optional(),
})
)
.output(GetEventTopLevelStatsSchema)
.query(async ({ input, ctx }) => {
assertAuthentication(ctx);
if (input.filter && Object.keys(input.filter).length === 0) input.filter = undefined;
const athenaEvents = new AthenaEvents(
LambdaEnvironment.ANALYTICS_GLUE_DB_NAME,