API CEO + USER v1.0

This commit is contained in:
andrei-mihnea-cerbu
2024-04-03 09:50:48 +03:00
parent 4f8719e9c8
commit 038b809dd8
7 changed files with 212 additions and 16 deletions
+3 -1
View File
@@ -7,6 +7,7 @@ const ceoModifyModelSchema = require('./ceoModifyModel');
const emailVerificationSchema = require('./emailVerificationModel');
const userDepartmentPatchSchema = require('./userDepartmentPatchModel');
const ceoPasswordModelSchema = require('./ceoPasswordModel');
const securityLevelsModelSchema = require('./securityLevelsModel');
module.exports = {
schemas: {
@@ -18,6 +19,7 @@ module.exports = {
ceoModifyModelSchema,
emailVerificationSchema,
userDepartmentPatchSchema,
ceoPasswordModelSchema
ceoPasswordModelSchema,
securityLevelsModelSchema
},
};
@@ -0,0 +1,19 @@
const Joi = require("joi");
// Define a schema for the string values (department names)
const nameSchema = Joi.string().required().messages({
'string.empty': 'Name can\'t be empty',
'any.required': 'Name is required'
});
// Define the main schema for the security levels model
const securityLevelsModel = Joi.object().pattern(
Joi.number().integer().positive().messages({
'number.base': 'Keys must be integers',
'number.integer': 'Keys must be integers',
'number.positive': 'Keys must be positive integers'
}),
nameSchema
);
module.exports = securityLevelsModel;