feat(api): admin report endpoint + ReportResponse contracts
This commit is contained in:
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user