🐛 (customDomains) Transform name to lower case before validating
This commit is contained in:
@ -4,7 +4,10 @@ import { z } from 'zod'
|
|||||||
const domainNameRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/
|
const domainNameRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/
|
||||||
|
|
||||||
export const customDomainSchema = z.object({
|
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(),
|
workspaceId: z.string(),
|
||||||
createdAt: z.date(),
|
createdAt: z.date(),
|
||||||
}) satisfies z.ZodType<CustomDomainInDb>
|
}) satisfies z.ZodType<CustomDomainInDb>
|
||||||
|
Reference in New Issue
Block a user