29 lines
939 B
JavaScript
29 lines
939 B
JavaScript
const Joi = require("joi");
|
|
|
|
// ========================
|
|
// Brand Validation
|
|
// ========================
|
|
const insertBrandSchema = Joi.object({
|
|
brand_name: Joi.string().max(100).required(),
|
|
brand_type: Joi.string().max(50).optional().allow(""),
|
|
brand_manufacture: Joi.string().max(100).required(),
|
|
brand_model: Joi.string().max(100).optional().allow(""),
|
|
is_active: Joi.boolean().optional().default(true),
|
|
description: Joi.string().max(255).optional().allow(""),
|
|
});
|
|
|
|
// Update Brand Validation
|
|
const updateBrandSchema = Joi.object({
|
|
brand_name: Joi.string().max(100).optional(),
|
|
brand_type: Joi.string().max(50).optional().allow(""),
|
|
brand_manufacture: Joi.string().max(100).optional(),
|
|
brand_model: Joi.string().max(100).optional().allow(""),
|
|
is_active: Joi.boolean().optional(),
|
|
description: Joi.string().max(255).optional().allow(""),
|
|
}).min(1);
|
|
|
|
module.exports = {
|
|
insertBrandSchema,
|
|
updateBrandSchema,
|
|
};
|