This commit is contained in:
Swift
2024-02-02 12:35:35 +03:30
parent 980763fd6e
commit b14c480f17
7 changed files with 211 additions and 8 deletions
+28
View File
@@ -0,0 +1,28 @@
const { body, validationResult } = require('express-validator')
const Complaint = require('../models/Complaint')
const { _sr } = require('../plugins/serverResponses')
const { checkValidations } = require('../plugins/controllersHelperFunctions')
const _faSr = _sr.fa
module.exports.create = [
[
body('fullName').notEmpty().withMessage(_faSr.required.name),
body('national').notEmpty().withMessage(_faSr.required.national_code),
body('phoneNumber').notEmpty().withMessage(_faSr.required.phone_number),
body('email').notEmpty().withMessage(_faSr.required.email),
body('deviceNumber').notEmpty().withMessage(_faSr.required.field),
body('receptionCode').notEmpty().withMessage(_faSr.required.field),
body('caption').notEmpty().withMessage(_faSr.required.caption),
body('callType').notEmpty().withMessage(_faSr.required.field),
],
checkValidations(validationResult),
(req, res) => {
const
}
]
+19
View File
@@ -0,0 +1,19 @@
const mongoose = require('mongoose')
const ComplaintSchema = mongoose.Schema({
fullName: String,
national: Number,
phoneNumber: Number,
deviceNumber: String,
email: String,
receptionCode: String,
caption: String,
callType: Boolean
})
module.exports = mongoose.model('Complaint', ComplaintSchema)
+4
View File
@@ -102,5 +102,9 @@ module.exports = [
{
name: 'نظر سنجی',
value: 'surveys'
},
{
name: 'شکایت ها',
value: 'complaint'
}
]