separated groups and suppliers for material GET
This commit is contained in:
@ -27,10 +27,10 @@ router.get('/samples', (req, res, next) => {
|
||||
})
|
||||
});
|
||||
|
||||
router.get('/samples/:group(new|deleted)', (req, res, next) => {
|
||||
router.get('/samples/:state(new|deleted)', (req, res, next) => {
|
||||
if (!req.auth(res, ['maintain', 'admin'], 'basic')) return;
|
||||
|
||||
SampleModel.find({status: globals.status[req.params.group]}).lean().exec((err, data) => {
|
||||
SampleModel.find({status: globals.status[req.params.state]}).lean().exec((err, data) => {
|
||||
if (err) return next(err);
|
||||
res.json(_.compact(data.map(e => SampleValidate.output(e)))); // validate all and filter null values from validation errors
|
||||
});
|
||||
|
Reference in New Issue
Block a user