mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-05 07:59:30 -05:00
Update validation
This commit is contained in:
@@ -404,57 +404,19 @@ const infrastructureMonitorValidation = joi.object({
|
||||
notifications: joi.array().items(joi.string()),
|
||||
});
|
||||
|
||||
const notificationEmailValidation = joi.object({
|
||||
const notificationValidation = joi.object({
|
||||
notificationName: joi.string().required().messages({
|
||||
"string.empty": "Notification name is required",
|
||||
"any.required": "Notification name is required",
|
||||
}),
|
||||
address: joi
|
||||
.string()
|
||||
.email({ tlds: { allow: false } })
|
||||
.required()
|
||||
.messages({
|
||||
"string.empty": "E-mail address cannot be empty",
|
||||
|
||||
"string.email": "Please enter a valid e-mail address",
|
||||
"string.base": "E-mail address must be a string",
|
||||
"any.required": "E-mail address is required",
|
||||
}),
|
||||
});
|
||||
const notificationWebhookValidation = joi.object({
|
||||
notificationName: joi.string().required().messages({
|
||||
"string.empty": "Notification name is required",
|
||||
"any.required": "Notification name is required",
|
||||
address: joi.string().required().messages({
|
||||
"string.empty": "This field cannot be empty",
|
||||
"string.base": "This field must be a string",
|
||||
"any.required": "This field is required",
|
||||
}),
|
||||
config: joi
|
||||
.object({
|
||||
webhookUrl: joi.string().uri().required().messages({
|
||||
"string.empty": "Webhook URL is required",
|
||||
"string.uri": "Webhook URL must be a valid URI",
|
||||
"any.required": "Webhook URL is required",
|
||||
}),
|
||||
platform: joi.string().required().messages({
|
||||
"string.base": "Platform must be a string",
|
||||
"any.required": "Platform is required",
|
||||
}),
|
||||
})
|
||||
.unknown(true),
|
||||
});
|
||||
|
||||
const notificationPagerDutyValidation = joi.object({
|
||||
notificationName: joi.string().required().messages({
|
||||
"string.empty": "Notification name is required",
|
||||
"any.required": "Notification name is required",
|
||||
}),
|
||||
config: joi.object({
|
||||
platform: joi.string().required().messages({
|
||||
"string.base": "Platform must be a string",
|
||||
"any.required": "Platform is required",
|
||||
}),
|
||||
routingKey: joi.string().required().messages({
|
||||
"string.empty": "Routing key is required",
|
||||
"any.required": "Routing key is required",
|
||||
}),
|
||||
type: joi.string().required().messages({
|
||||
"string.empty": "This field is required",
|
||||
"any.required": "This field is required",
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -469,7 +431,5 @@ export {
|
||||
infrastructureMonitorValidation,
|
||||
statusPageValidation,
|
||||
logoImageValidation,
|
||||
notificationEmailValidation,
|
||||
notificationWebhookValidation,
|
||||
notificationPagerDutyValidation,
|
||||
notificationValidation,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user