Update captionController.js
This commit is contained in:
@@ -11,18 +11,39 @@ 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('phoneNumber').notEmpty().isMobilePhone().withMessage(_faSr.required.phone_number),
|
||||
body('email').notEmpty().isEmail().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),
|
||||
body('callType').notEmpty().isBoolean().withMessage(_faSr.required.field),
|
||||
|
||||
],
|
||||
checkValidations(validationResult),
|
||||
(req, res) => {
|
||||
async(req, res) => {
|
||||
|
||||
const
|
||||
const complaint = await Complaint.create(req.body)
|
||||
|
||||
res.status(201).json(complaint)
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
module.exports.gets = [
|
||||
async(req, res)=>{
|
||||
const complaints = await Complaint.find()
|
||||
|
||||
res.status(200).json(complaints)
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
module.exports.get = [
|
||||
async(req, res)=>{
|
||||
const complaint = await Complaint.findById(req.params.id)
|
||||
|
||||
res.status(200).json(complaint)
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user