Add validation to org slug

This commit is contained in:
Tuan Dang
2024-02-07 09:39:06 -08:00
parent fc7015de83
commit 9011394c34
3 changed files with 23 additions and 5 deletions
@@ -88,7 +88,11 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
params: z.object({ organizationId: z.string().trim() }),
body: z.object({
name: z.string().trim().optional(),
slug: z.string().trim().optional(),
slug: z
.string()
.trim()
.regex(/^[a-zA-Z0-9-]+$/, "Name must only contain alphanumeric characters or hyphens")
.optional(),
authEnforced: z.boolean().optional()
}),
response: {