refactor subdomain inputs

This commit is contained in:
miloschwartz
2025-02-18 22:56:46 -05:00
parent 82f990eb8b
commit e49fb646b0
8 changed files with 404 additions and 144 deletions

View File

@@ -43,6 +43,15 @@ const updateHttpResourceBodySchema = z
.refine((data) => Object.keys(data).length > 0, {
message: "At least one field must be provided for update"
})
.refine(
(data) => {
if (data.subdomain) {
return subdomainSchema.safeParse(data.subdomain).success;
}
return true;
},
{ message: "Invalid subdomain" }
)
.refine(
(data) => {
if (!config.getRawConfig().flags?.allow_base_domain_resources) {
@@ -206,7 +215,7 @@ async function updateHttpResource(
if (updateData.isBaseDomain) {
fullDomain = domain.baseDomain;
} else if (subdomain && domain) {
fullDomain = `${subdomain}.${domain}`;
fullDomain = `${subdomain}.${domain.baseDomain}`;
}
if (fullDomain) {