add survey
This commit is contained in:
@@ -20,8 +20,19 @@ module.exports.create = [
|
||||
],
|
||||
checkValidations(validationResult),
|
||||
async(req, res) => {
|
||||
const { fullName, national, phoneNumber, deviceNumber, email, receptionCode, caption, callType } = req.body
|
||||
|
||||
const complaint = await Complaint.create(req.body)
|
||||
const complaint = await Complaint.create({
|
||||
fullName,
|
||||
national,
|
||||
type:0,
|
||||
phoneNumber,
|
||||
deviceNumber,
|
||||
callType,
|
||||
email,
|
||||
receptionCode,
|
||||
caption
|
||||
})
|
||||
|
||||
res.status(201).json(complaint)
|
||||
|
||||
@@ -29,9 +40,44 @@ module.exports.create = [
|
||||
]
|
||||
|
||||
|
||||
module.exports.gets = [
|
||||
module.exports.createSurvey = [
|
||||
[
|
||||
body('fullName').notEmpty().withMessage(_faSr.required.name),
|
||||
body('national').notEmpty().withMessage(_faSr.required.national_code),
|
||||
body('phoneNumber').notEmpty().isMobilePhone().withMessage(_faSr.required.phone_number),
|
||||
body('email').notEmpty().isEmail().withMessage(_faSr.required.email),
|
||||
body('caption').notEmpty().withMessage(_faSr.required.caption),
|
||||
],
|
||||
checkValidations(validationResult),
|
||||
async(req, res) => {
|
||||
const { fullName, national, phoneNumber, email, receptionCode, caption } = req.body
|
||||
const complaint = await Complaint.create({
|
||||
fullName,
|
||||
national,
|
||||
type:1,
|
||||
phoneNumber,
|
||||
email,
|
||||
receptionCode,
|
||||
caption
|
||||
})
|
||||
|
||||
res.status(201).json(complaint)
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
module.exports.getsComplaint = [
|
||||
async(req, res)=>{
|
||||
const complaints = await Complaint.find()
|
||||
const complaints = await Complaint.find({type:0})
|
||||
|
||||
res.status(200).json(complaints)
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
module.exports.getsSurvey = [
|
||||
async(req, res)=>{
|
||||
const complaints = await Complaint.find({type:1})
|
||||
|
||||
res.status(200).json(complaints)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user