This commit is contained in:
mahyargdz
2024-12-31 16:25:51 +03:30
parent 7203e27762
commit 8c35d399c6
+31 -5
View File
@@ -409,8 +409,6 @@ module.exports.updateUserByAdmin = [
})
}),
body('shopName').optional().notEmpty().withMessage(_faSr.required.address),
body('mobile_number')
.optional()
.notEmpty()
@@ -431,9 +429,37 @@ module.exports.updateUserByAdmin = [
})
}),
body('cell_number').optional().notEmpty().withMessage(_faSr.required.phone_number).bail(),
body('birthDate').optional().notEmpty().withMessage(_faSr.required.birthdate).bail(),
body('address').optional().notEmpty().withMessage(_faSr.required.address).bail()
body('shopName')
.optional()
.custom((value, { req }) => {
if (value === '') return true
return value ? true : Promise.reject(_faSr.required.shop_name)
})
.bail(),
body('cell_number')
.optional()
.custom((value, { req }) => {
if (value === '') return true
return value ? true : Promise.reject(_faSr.required.phone_number)
})
.bail(),
body('birthDate')
.optional()
.custom((value, { req }) => {
if (value === '') return true
return value ? true : Promise.reject(_faSr.required.birthdate)
})
.bail(),
body('address')
.optional()
.custom((value, { req }) => {
if (value === '') return true
return value ? true : Promise.reject(_faSr.required.address)
})
.bail()
],
checkValidations(validationResult),
async (req, res) => {