refactor(api): extract adminGuard + add user-management contracts
This commit is contained in:
@@ -78,15 +78,33 @@ export const StartSessionInput = z.object({
|
||||
});
|
||||
export type StartSessionInput = z.infer<typeof StartSessionInput>;
|
||||
|
||||
export const UserStatus = z.enum(['active', 'inactive']);
|
||||
export type UserStatus = z.infer<typeof UserStatus>;
|
||||
|
||||
export const AdminUser = z.object({
|
||||
id: z.string(),
|
||||
email: z.string().email(),
|
||||
name: z.string(),
|
||||
role: Role,
|
||||
status: UserStatus,
|
||||
created_at: z.string(),
|
||||
});
|
||||
export type AdminUser = z.infer<typeof AdminUser>;
|
||||
|
||||
export const CreateUserInput = z.object({
|
||||
email: z.string().email(),
|
||||
name: z.string().trim().min(1),
|
||||
password: z.string().min(8),
|
||||
role: Role,
|
||||
});
|
||||
export type CreateUserInput = z.infer<typeof CreateUserInput>;
|
||||
|
||||
export const SetRoleInput = z.object({ role: Role });
|
||||
export type SetRoleInput = z.infer<typeof SetRoleInput>;
|
||||
|
||||
export const SetPasswordInput = z.object({ password: z.string().min(8) });
|
||||
export type SetPasswordInput = z.infer<typeof SetPasswordInput>;
|
||||
|
||||
export const CreateManualSessionInput = z.object({
|
||||
user_id: z.string(),
|
||||
activity_id: z.number().int(),
|
||||
|
||||
Reference in New Issue
Block a user