back-end done

This commit is contained in:
Amir Mohamadi
2020-12-10 16:36:48 +03:30
parent 80a7abafb7
commit bc5e617778
92 changed files with 5217 additions and 3379 deletions
+7 -1
View File
@@ -49,6 +49,12 @@ module.exports.create = [
return v_m[req.body.locale].format.email
}),
body('reason')
.custom((value, {req}) => {
if (!value) return Promise.reject(v_m[req.body.locale].required.reason)
else return true
}),
body('message')
.isLength({min: 50})
.withMessage((value, {req}) => {
@@ -66,7 +72,7 @@ module.exports.create = [
phone_number: req.body.phone_number,
email: req.body.email,
message: req.body.message,
user_id: req.body.user_id,
reason: req.body.reason,
created_at: dateformat(Date.now(), 'yyyy-mm-dd HH:MM:ss')
}
const message = new ContactPageMessage(data)