feat(shared): add Role enum + admin user fields on WorkSession contract

This commit is contained in:
Bas van Rossem
2026-06-17 17:23:20 +02:00
parent decb158044
commit 8bfdfb736e

View File

@@ -20,6 +20,9 @@ export type MeResponse = z.infer<typeof MeResponse>;
export const InsoleType = z.enum(['Kurk', 'Berk', '3D']);
export type InsoleType = z.infer<typeof InsoleType>;
export const Role = z.enum(['worker', 'admin']);
export type Role = z.infer<typeof Role>;
export const Activity = z.object({
id: z.number().int(),
name: z.string(),
@@ -45,6 +48,8 @@ export const WorkSession = z.object({
user_id: z.string(),
activity_id: z.number().int(),
activity_name: z.string().optional(), // present on history/active joins
user_name: z.string().optional(), // present only on admin cross-user views
user_email: z.string().optional(), // present only on admin cross-user views
insole_type: InsoleType.nullable(),
pair_count: z.number().int(),
start_time: z.string(), // ISO-8601
@@ -63,3 +68,12 @@ export const StartSessionInput = z.object({
pair_count: z.number().int().min(1).default(2),
});
export type StartSessionInput = z.infer<typeof StartSessionInput>;
export const AdminUser = z.object({
id: z.string(),
email: z.string().email(),
name: z.string(),
role: Role,
created_at: z.string(),
});
export type AdminUser = z.infer<typeof AdminUser>;