add: CRUD tags
This commit is contained in:
29
validate/tags.schema.js
Normal file
29
validate/tags.schema.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// ========================
|
||||
// Device Validation
|
||||
|
||||
const Joi = require("joi");
|
||||
|
||||
// ========================
|
||||
const insertTagsSchema = Joi.object({
|
||||
device_id: Joi.number().required(),
|
||||
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(),
|
||||
});
|
||||
|
||||
const updateTagsSchema = Joi.object({
|
||||
device_id: Joi.number(),
|
||||
tag_name: Joi.string().max(200),
|
||||
tag_number: Joi.number(),
|
||||
is_active: Joi.boolean(),
|
||||
data_type: Joi.string().max(50),
|
||||
unit: Joi.string().max(50),
|
||||
}).min(1);
|
||||
|
||||
// ✅ Export dengan CommonJS
|
||||
module.exports = {
|
||||
insertTagsSchema,
|
||||
updateTagsSchema,
|
||||
};
|
||||
Reference in New Issue
Block a user