2
0

🐛 (customDomains) Transform name to lower case before validating

This commit is contained in:
Baptiste Arnaud
2023-08-22 11:11:20 +02:00
parent 6240fd982b
commit 83352d77f5

View File

@ -4,7 +4,10 @@ import { z } from 'zod'
const domainNameRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/
export const customDomainSchema = z.object({
name: z.string().refine((name) => domainNameRegex.test(name)),
name: z
.string()
.transform((name) => name.toLowerCase())
.refine((name) => domainNameRegex.test(name)),
workspaceId: z.string(),
createdAt: z.date(),
}) satisfies z.ZodType<CustomDomainInDb>