fix surveys
This commit is contained in:
@@ -104,12 +104,22 @@ module.exports.getAllForUser = [
|
||||
|
||||
module.exports.getAllForAdmin = [
|
||||
(req, res) => {
|
||||
Survey.find({type:req.query.type || 0})
|
||||
.populate('user', 'first_name last_name')
|
||||
.exec((err, data) => {
|
||||
if (err) return res500(res, err)
|
||||
return res.json(data)
|
||||
})
|
||||
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if(req.query.type == 1){
|
||||
Survey.find({type: 1 })
|
||||
.exec((err, data) => {
|
||||
if (err) return res500(res, err)
|
||||
return res.json(data)
|
||||
})
|
||||
}else{
|
||||
Survey.find({type: 0 })
|
||||
.populate('user', 'first_name last_name')
|
||||
.exec((err, data) => {
|
||||
if (err) return res500(res, err)
|
||||
return res.json(data)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user