remove awardings simple parameter
parent
e284fffdee
commit
dc0de2db89
|
@ -32,22 +32,6 @@ awarding.route('/')
|
||||||
if (req.query.inProgress) {
|
if (req.query.inProgress) {
|
||||||
filter.confirmed = 0;
|
filter.confirmed = 0;
|
||||||
}
|
}
|
||||||
if (req.query.simple) {
|
|
||||||
AwardingModel.find(filter, {}, {sort: {date: 'desc'}}, (err, items) => {
|
|
||||||
if (err) {
|
|
||||||
err.status = codes.servererror;
|
|
||||||
return next(err);
|
|
||||||
// with return before (or after) the next(err) we prevent that the code continues here after next(err)
|
|
||||||
// has finished. this saves an extra else {..}
|
|
||||||
}
|
|
||||||
// if the collection is empty we do not send empty arrays back.
|
|
||||||
if (items && items.length > 0) {
|
|
||||||
res.locals.items = items;
|
|
||||||
}
|
|
||||||
res.locals.processed = true;
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
AwardingModel.find(filter, {}, {sort: {date: 'desc'}})
|
AwardingModel.find(filter, {}, {sort: {date: 'desc'}})
|
||||||
.populate('decorationId').populate('proposer', resultSet)
|
.populate('decorationId').populate('proposer', resultSet)
|
||||||
.exec((err, items) => {
|
.exec((err, items) => {
|
||||||
|
@ -72,7 +56,6 @@ awarding.route('/')
|
||||||
res.locals.processed = true;
|
res.locals.processed = true;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
.post(apiAuthenticationMiddleware, checkHl, (req, res, next) => {
|
.post(apiAuthenticationMiddleware, checkHl, (req, res, next) => {
|
||||||
|
|
Loading…
Reference in New Issue