bug fixes to smooth out multi domain inputs forms

This commit is contained in:
miloschwartz 2025-02-19 23:00:59 -05:00
parent e49fb646b0
commit c877bb1187
No known key found for this signature in database
4 changed files with 111 additions and 57 deletions

View file

@ -31,7 +31,10 @@ const createResourceParamsSchema = z
const createHttpResourceSchema = z
.object({
name: z.string().min(1).max(255),
subdomain: z.string().optional(),
subdomain: z
.string()
.optional()
.transform((val) => val?.toLowerCase()),
isBaseDomain: z.boolean().optional(),
siteId: z.number(),
http: z.boolean(),
@ -128,7 +131,7 @@ export async function createResource(
);
}
if (!req.body?.http) {
if (typeof req.body.http !== "boolean") {
return next(
createHttpError(HttpCode.BAD_REQUEST, "http field is required")
);
@ -233,6 +236,7 @@ async function createHttpResource(
.values({
siteId,
fullDomain,
domainId,
orgId,
name,
subdomain,