bigbuffet-rw/packages/pl-api/lib/entities/role.ts
marcin mikołajczak 036fa32cd3 Add pl-api to workspace
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-28 13:43:23 +02:00

18 lines
362 B
TypeScript

import { z } from 'zod';
const hexSchema = z.string().regex(/^#[a-f0-9]{6}$/i);
const roleSchema = z.object({
id: z.string().catch(''),
name: z.string().catch(''),
color: hexSchema.catch(''),
permissions: z.string().catch(''),
highlighted: z.boolean().catch(true),
});
type Role = z.infer<typeof roleSchema>;
export {
roleSchema,
type Role,
};