Archived
2

PUT method

This commit is contained in:
VLE2FE
2020-05-12 17:15:36 +02:00
parent 4185452ff3
commit ff36b49cc5
14 changed files with 267 additions and 13 deletions

View File

@ -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
})
});