update validation

This commit is contained in:
Alex Holliday committed 2025-05-09 13:28:04 -07:00
1 parent a6ab7b652f
commit cba744f777
1 file changed
+14 -9
+14 -9
View File
@@ -11,7 +11,8 @@ const nameSchema = joi
.messages({
"string.empty": "Name is required",
"string.max": "Name must be less than 50 characters",
"string.pattern.base": "Name must contain only letters, spaces, apostrophes, or hyphens"
"string.pattern.base":
"Name must contain only letters, spaces, apostrophes, or hyphens",
});
const passwordSchema = joi
@@ -152,7 +153,8 @@ const monitorValidation = joi.object({
"string.invalidUrl": "Please enter a valid URL with optional port",
"string.pattern.base": "Please enter a valid container ID.",
}),
port: joi.number()
port: joi
.number()
.integer()
.min(1)
.max(65535)
@@ -253,14 +255,14 @@ const statusPageValidation = joi.object({
showCharts: joi.boolean(),
});
const settingsValidation = joi.object({
ttl: joi.number().required().messages({
checkTTL: joi.number().required().messages({
"string.empty": "Please enter a value",
"number.base": "Please enter a valid number",
"any.required": "Please enter a value"
"any.required": "Please enter a value",
}),
pagespeedApiKey: joi.string().allow("").optional(),
})
.unknown(true);
language: joi.string().required(),
});
const dayjsValidator = (value, helpers) => {
if (!dayjs(value).isValid()) {
@@ -363,9 +365,12 @@ const infrastructureMonitorValidation = joi.object({
notifications: joi.array().items(
joi.object({
type: joi.string().valid("email").required(),
address: joi.string().email({ tlds: { allow: false } }).required(),
address: joi
.string()
.email({ tlds: { allow: false } })
.required(),
})
)
),
});
export {
@@ -377,5 +382,5 @@ export {
advancedSettingsValidation,
infrastructureMonitorValidation,
statusPageValidation,
logoImageValidation
logoImageValidation,
};