feat(shared): add Role enum + admin user fields on WorkSession contract
This commit is contained in:
@@ -20,6 +20,9 @@ export type MeResponse = z.infer<typeof MeResponse>;
|
|||||||
export const InsoleType = z.enum(['Kurk', 'Berk', '3D']);
|
export const InsoleType = z.enum(['Kurk', 'Berk', '3D']);
|
||||||
export type InsoleType = z.infer<typeof InsoleType>;
|
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({
|
export const Activity = z.object({
|
||||||
id: z.number().int(),
|
id: z.number().int(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
@@ -45,6 +48,8 @@ export const WorkSession = z.object({
|
|||||||
user_id: z.string(),
|
user_id: z.string(),
|
||||||
activity_id: z.number().int(),
|
activity_id: z.number().int(),
|
||||||
activity_name: z.string().optional(), // present on history/active joins
|
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(),
|
insole_type: InsoleType.nullable(),
|
||||||
pair_count: z.number().int(),
|
pair_count: z.number().int(),
|
||||||
start_time: z.string(), // ISO-8601
|
start_time: z.string(), // ISO-8601
|
||||||
@@ -63,3 +68,12 @@ export const StartSessionInput = z.object({
|
|||||||
pair_count: z.number().int().min(1).default(2),
|
pair_count: z.number().int().min(1).default(2),
|
||||||
});
|
});
|
||||||
export type StartSessionInput = z.infer<typeof StartSessionInput>;
|
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>;
|
||||||
|
|||||||
Reference in New Issue
Block a user