21 lines
634 B
TypeScript
21 lines
634 B
TypeScript
import { z } from "zod";
|
|
|
|
export const CreateRoleSchema = z.object({
|
|
name: z.string().min(1).max(100),
|
|
description: z.string().max(500).optional(),
|
|
color: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
|
|
});
|
|
|
|
export const UpdateRoleSchema = CreateRoleSchema.partial().extend({
|
|
isActive: z.boolean().optional(),
|
|
});
|
|
|
|
export const ResourceRoleSchema = z.object({
|
|
roleId: z.string(),
|
|
isPrimary: z.boolean().default(false),
|
|
});
|
|
|
|
export type CreateRoleInput = z.infer<typeof CreateRoleSchema>;
|
|
export type UpdateRoleInput = z.infer<typeof UpdateRoleSchema>;
|
|
export type ResourceRoleInput = z.infer<typeof ResourceRoleSchema>;
|