INNER CODE UNIT · TypeScript

getPageTopLevelStats

rehanvdm/serverless-website-analytics · application/src/backend/api-front/routes/stats/page/index.ts:31

export function getPageTopLevelStats(trpcInstance: TrpcInstance) {
  return trpcInstance.procedure
    .input(
      z.object({
        from: z.string().datetime(),
        to: z.string().datetime(),
        sites: z.array(SchemaSite),
        filter: PageFilterSchema.optional(),
      })
    )
    .output(GetPageTopLevelStatsSchema)
    .query(async ({ input, ctx }) => {
      assertAuthentication(ctx);

      if (input.filter && Object.keys(input.filter).length === 0) input.filter = undefined;

      const athenaPageViews = new AthenaPageViews(
        LambdaEnvironment.ANALYTICS_GLUE_DB_NAME,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…