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') body('mobile_number')
.optional() .optional()
.notEmpty() .notEmpty()
@@ -431,9 +429,37 @@ module.exports.updateUserByAdmin = [
}) })
}), }),
body('cell_number').optional().notEmpty().withMessage(_faSr.required.phone_number).bail(), body('shopName')
body('birthDate').optional().notEmpty().withMessage(_faSr.required.birthdate).bail(), .optional()
body('address').optional().notEmpty().withMessage(_faSr.required.address).bail() .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), checkValidations(validationResult),
async (req, res) => { async (req, res) => {