Function userValidate
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
exports.userValidate = (req, res, next) => {
const userValiation = Joi.object({
name: Joi.string().required().messages({
"any.required": res.__('name is required'),
"string.empty": res.__('name not empty')
Function userUpdateValidate
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
exports.userUpdateValidate = (req, res, next) => {
const userValiation = Joi.object({
name: Joi.string().messages({
"string.empty": res.__('name not empty')
}),
Similar blocks of code found in 2 locations. Consider refactoring.
gender: Joi.string().max(8).required().messages({
"string.max": res.__("gender should be not more 8 characters"),
"any.required": res.__('gender is required'),
"string.empty": res.__('gender not empty')
}),
Similar blocks of code found in 2 locations. Consider refactoring.
phone: Joi.string().min(10).required().messages({
"string.min": res.__("Phone should be at least 10 digits"),
"any.required": res.__('Phone should be required'),
"string.empty": res.__('Phone is required')
}),
Similar blocks of code found in 2 locations. Consider refactoring.
email: Joi.string().required().email().messages({
"string.email": res.__("provide valid email"),
"any.required": res.__('email is required'),
"string.empty": res.__('email not empty')
}),
Similar blocks of code found in 2 locations. Consider refactoring.
gender: Joi.string().max(8).messages({
"string.max": res.__("gender should be not more 8 characters"),
"string.empty": res.__('gender not empty')
}),
Similar blocks of code found in 2 locations. Consider refactoring.
phone: Joi.string().min(10).messages({
"string.min": res.__("Phone should be at least 10 digits"),
"string.empty": res.__('Phone is required')
}),
Similar blocks of code found in 6 locations. Consider refactoring.
email: Joi.string().email().messages({
"string.email": res.__("provide valid email"),
"string.empty": res.__('email not empty')
}),
Similar blocks of code found in 6 locations. Consider refactoring.
name: Joi.string().required().messages({
"any.required": res.__('name is required'),
"string.empty": res.__('name not empty')
}),
Similar blocks of code found in 6 locations. Consider refactoring.
birthdate: Joi.date().required().messages({
"any.required": res.__('birthdate is required'),
"string.empty": res.__('birthdate is required')
}),
Identical blocks of code found in 4 locations. Consider refactoring.
if (result.error) return res.status(400).json({ message: result.error.details[0].message });
Identical blocks of code found in 4 locations. Consider refactoring.
if (result.error) return res.status(400).json({ message: result.error.details[0].message });
There are no issues that match your filters.