PUT method
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import express from 'express';
|
||||
import _ from 'lodash';
|
||||
|
||||
import SampleValidate from './validate/sample';
|
||||
import NoteFieldValidate from './validate/note_field';
|
||||
@ -17,7 +18,7 @@ router.get('/samples', (req, res, next) => {
|
||||
|
||||
SampleModel.find({}).lean().exec((err, data) => {
|
||||
if (err) return next(err);
|
||||
res.json(data.map(e => SampleValidate.output(e)).filter(e => e !== null)); // validate all and filter null values from validation errors
|
||||
res.json(_.compact(data.map(e => SampleValidate.output(e)))); // validate all and filter null values from validation errors
|
||||
})
|
||||
});
|
||||
|
||||
@ -141,7 +142,7 @@ router.get('/sample/notes/fields', (req, res, next) => {
|
||||
|
||||
NoteFieldModel.find({}).lean().exec((err, data) => {
|
||||
if (err) return next(err);
|
||||
res.json(data.map(e => NoteFieldValidate.output(e)).filter(e => e !== null)); // validate all and filter null values from validation errors
|
||||
res.json(_.compact(data.map(e => NoteFieldValidate.output(e)))); // validate all and filter null values from validation errors
|
||||
})
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user