fix: tag validate
This commit is contained in:
@@ -5,12 +5,13 @@ const Joi = require("joi");
|
||||
|
||||
// ========================
|
||||
const insertTagsSchema = Joi.object({
|
||||
device_id: Joi.number(),
|
||||
device_id: Joi.number().optional(),
|
||||
tag_name: Joi.string().max(200).required(),
|
||||
tag_number: Joi.number().required(),
|
||||
is_active: Joi.boolean().required(),
|
||||
data_type: Joi.string().max(50).required(),
|
||||
unit: Joi.string().max(50).required(),
|
||||
sub_section_id: Joi.number().optional(),
|
||||
is_alarm: Joi.boolean().required()
|
||||
});
|
||||
|
||||
@@ -21,7 +22,8 @@ const updateTagsSchema = Joi.object({
|
||||
is_active: Joi.boolean(),
|
||||
data_type: Joi.string().max(50),
|
||||
unit: Joi.string().max(50),
|
||||
is_alarm: Joi.boolean().optional()
|
||||
is_alarm: Joi.boolean().optional(),
|
||||
sub_section_id: Joi.number().optional(),
|
||||
}).min(1);
|
||||
|
||||
// ✅ Export dengan CommonJS
|
||||
|
||||
Reference in New Issue
Block a user