add & repair: roles schema,roles service & roles router, roles controller

This commit is contained in:
Muhammad Afif
2025-10-10 17:24:32 +07:00
parent 6c7d92deae
commit c51c686cce
7 changed files with 307 additions and 262 deletions

23
validate/roles.schema.js Normal file
View File

@@ -0,0 +1,23 @@
// ========================
// Device Validation
const Joi = require("joi");
// ========================
const insertRolesSchema = Joi.object({
role_name: Joi.string().max(100).required(),
role_level: Joi.number().required(),
role_description: Joi.string().max(100).required(),
});
const updateRolesSchema = Joi.object({
role_name: Joi.string().max(100),
role_level: Joi.number(),
role_description: Joi.string().max(100),
}).min(1);
// ✅ Export dengan CommonJS
module.exports = {
insertRolesSchema, updateRolesSchema
};