wisdom #2
24
validate/status.schema.js
Normal file
24
validate/status.schema.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const Joi = require("joi");
|
||||||
|
|
||||||
|
// ========================
|
||||||
|
// Status Validation
|
||||||
|
// ========================
|
||||||
|
const insertStatusSchema = Joi.object({
|
||||||
|
status_number: Joi.number().integer().required(),
|
||||||
|
status_name: Joi.string().max(200).required(),
|
||||||
|
status_color: Joi.string().max(200).required(),
|
||||||
|
status_description: Joi.string().allow('', null)
|
||||||
|
});
|
||||||
|
|
||||||
|
const updateStatusSchema = Joi.object({
|
||||||
|
status_number: Joi.number().integer(),
|
||||||
|
status_name: Joi.string().max(200),
|
||||||
|
status_color: Joi.string().max(200),
|
||||||
|
status_description: Joi.string().allow('', null)
|
||||||
|
}).min(1);
|
||||||
|
|
||||||
|
// ✅ Export dengan CommonJS
|
||||||
|
module.exports = {
|
||||||
|
insertStatusSchema,
|
||||||
|
updateStatusSchema
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user