add: validate is_active

This commit is contained in:
2025-10-17 10:44:26 +07:00
parent b146fe3ffa
commit 2bb8712430
4 changed files with 20 additions and 13 deletions

View File

@@ -11,7 +11,8 @@ const insertSubSectionSchema = Joi.object({
"string.base": "Sub section name must be a string",
"string.max": "Sub section name cannot exceed 200 characters",
"any.required": "Sub section name is required"
}),
}).required(),
is_active: Joi.boolean().required(),
});
const updateSubSectionSchema = Joi.object({
@@ -20,7 +21,8 @@ const updateSubSectionSchema = Joi.object({
.messages({
"string.base": "Sub section name must be a string",
"string.max": "Sub section name cannot exceed 200 characters",
}),
}).optional(),
is_active: Joi.boolean().optional(),
}).min(1).messages({
"object.min": "At least one field must be provided to update",
});