crud: brand sparepart
This commit is contained in:
32
validate/brand_sparepart.schema.js
Normal file
32
validate/brand_sparepart.schema.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const Joi = require("joi");
|
||||
|
||||
// ========================
|
||||
// Brand Validation
|
||||
// ========================
|
||||
const insertBrandSparepartSchema = Joi.object({
|
||||
sparepart_name: Joi.string().max(255).required(),
|
||||
brand_sparepart_description: Joi.string().max(255).required(),
|
||||
is_active: Joi.boolean().required(),
|
||||
error_code_id: Joi.number().required().messages({
|
||||
"any.required": "error_code_id is required",
|
||||
"number.base": "error_code_id must be a number",
|
||||
}),
|
||||
path_foto: Joi.string().max(255).optional().allow(''),
|
||||
});
|
||||
|
||||
// Update Brand Validation
|
||||
const updateBrandSparepartSchema = Joi.object({
|
||||
sparepart_name: Joi.string().max(255).required(),
|
||||
brand_sparepart_description: Joi.string().max(255).required(),
|
||||
is_active: Joi.boolean().optional(),
|
||||
error_code_id: Joi.number().required().messages({
|
||||
"any.required": "error_code_id is required",
|
||||
"number.base": "error_code_id must be a number",
|
||||
}),
|
||||
path_foto: Joi.string().max(255).optional().allow(''),
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
insertBrandSparepartSchema,
|
||||
updateBrandSparepartSchema,
|
||||
};
|
||||
Reference in New Issue
Block a user