group validation

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-03-16 20:38:51 +01:00
parent fa78e63bc8
commit 995f32c5d8
4 changed files with 131 additions and 72 deletions

View File

@@ -540,6 +540,32 @@ export const zCheckout = z.object({
});
export type ICheckout = z.infer<typeof zCheckout>;
export const zGroupId = z
.string()
.min(1)
.regex(
/^[a-z0-9_-]+$/,
'ID must only contain lowercase letters, digits, hyphens, or underscores',
);
export const zCreateGroup = z.object({
id: zGroupId,
projectId: z.string(),
type: z.string().min(1),
name: z.string().min(1),
properties: z.record(z.string()).default({}),
});
export type ICreateGroup = z.infer<typeof zCreateGroup>;
export const zUpdateGroup = z.object({
id: z.string().min(1),
projectId: z.string(),
type: z.string().min(1).optional(),
name: z.string().min(1).optional(),
properties: z.record(z.string()).optional(),
});
export type IUpdateGroup = z.infer<typeof zUpdateGroup>;
export const zEditOrganization = z.object({
id: z.string().min(2),
name: z.string().min(2),