feat: add Zod validation schemas for all domain routes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
17
src/schemas/roles.schema.ts
Normal file
17
src/schemas/roles.schema.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const CreateRoleSchema = z.object({
|
||||
name: z.string().min(1, 'Název role je povinný'),
|
||||
display_name: z.string().min(1, 'Zobrazovaný název je povinný'),
|
||||
description: z.string().nullish(),
|
||||
permission_ids: z.array(z.number()).optional(),
|
||||
});
|
||||
|
||||
export const UpdateRoleSchema = z.object({
|
||||
display_name: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
permission_ids: z.array(z.number()).optional(),
|
||||
});
|
||||
|
||||
export type CreateRoleInput = z.infer<typeof CreateRoleSchema>;
|
||||
export type UpdateRoleInput = z.infer<typeof UpdateRoleSchema>;
|
||||
Reference in New Issue
Block a user