add: CRUD tags

This commit is contained in:
Muhammad Afif
2025-10-10 20:06:56 +07:00
parent ee30308112
commit 425b1ed554
8 changed files with 358 additions and 122 deletions

29
validate/tags.schema.js Normal file
View 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,
};