feat(api): admin report endpoint + ReportResponse contracts

This commit is contained in:
Bas van Rossem
2026-06-24 16:25:36 +02:00
parent 01fa18f401
commit 4b213e25a8
3 changed files with 328 additions and 2 deletions

View File

@@ -110,3 +110,37 @@ export const AdminUpdateSessionInput = z.object({
status: SessionStatus,
});
export type AdminUpdateSessionInput = z.infer<typeof AdminUpdateSessionInput>;
export const ReportTotals = z.object({
worked_seconds: z.number().int(),
paused_seconds: z.number().int(),
pairs: z.number().int(),
sessions: z.number().int(),
});
export type ReportTotals = z.infer<typeof ReportTotals>;
export const ReportWorkerRow = ReportTotals.extend({
user_id: z.string(),
user_name: z.string(),
});
export type ReportWorkerRow = z.infer<typeof ReportWorkerRow>;
export const ReportActivityRow = ReportTotals.extend({
activity_id: z.number().int(),
activity_name: z.string(),
});
export type ReportActivityRow = z.infer<typeof ReportActivityRow>;
export const ReportTypeRow = ReportTotals.extend({
insole_type: z.string(),
});
export type ReportTypeRow = z.infer<typeof ReportTypeRow>;
export const ReportResponse = z.object({
range: z.object({ from: z.string(), to: z.string() }),
totals: ReportTotals,
by_worker: z.array(ReportWorkerRow),
by_activity: z.array(ReportActivityRow),
by_type: z.array(ReportTypeRow),
});
export type ReportResponse = z.infer<typeof ReportResponse>;