mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-08-09 11:04:36 +00:00
35 lines
839 B
TypeScript
35 lines
839 B
TypeScript
import { z } from 'zod';
|
|
|
|
export const UserRoleEnum = z.enum([
|
|
'superuser',
|
|
'admin',
|
|
'manager',
|
|
'group_leader',
|
|
'developer',
|
|
]);
|
|
export type UserRole = z.infer<typeof UserRoleEnum>;
|
|
|
|
export const UserSchema = z.object({
|
|
id: z.string(),
|
|
email: z.string().email(),
|
|
name: z.string(),
|
|
avatar_url: z.string().optional(),
|
|
organization_id: z.string(),
|
|
role: UserRoleEnum,
|
|
is_active: z.boolean().default(true),
|
|
created_at: z.string().optional(),
|
|
updated_at: z.string().optional(),
|
|
});
|
|
|
|
export const CreateUserSchema = UserSchema.omit({
|
|
id: true,
|
|
created_at: true,
|
|
updated_at: true,
|
|
});
|
|
|
|
export const UpdateUserSchema = CreateUserSchema.partial();
|
|
|
|
export type User = z.infer<typeof UserSchema>;
|
|
export type CreateUser = z.infer<typeof CreateUserSchema>;
|
|
export type UpdateUser = z.infer<typeof UpdateUserSchema>;
|