added status to POST method
This commit is contained in:
parent
a516062822
commit
5c9aa8debd
@ -82,9 +82,10 @@ describe('/measurement', () => {
|
||||
}).end((err, res) => {
|
||||
if (err) return done(err);
|
||||
MeasurementModel.findById(res.body._id).lean().exec((err, data: any) => {
|
||||
should(data).have.only.keys('_id', 'condition_id', 'values', 'measurement_template', '__v');
|
||||
should(data).have.only.keys('_id', 'condition_id', 'values', 'measurement_template', 'status', '__v');
|
||||
should(data.condition_id.toString()).be.eql('700000000000000000000001');
|
||||
should(data.measurement_template.toString()).be.eql('300000000000000000000002');
|
||||
should(data).have.property('status', 0);
|
||||
should(data).have.property('values');
|
||||
should(data.values).have.property('weight %', 0.8);
|
||||
should(data.values).have.property('standard deviation', 0.1);
|
||||
|
@ -33,6 +33,7 @@ router.post('/measurement/new', async (req, res, next) => {
|
||||
if (!await conditionIdCheck(measurement, req, res, next)) return;
|
||||
if (!await templateCheck(measurement, 'new', res, next)) return;
|
||||
|
||||
measurement.status =
|
||||
await new MeasurementModel(measurement).save((err, data) => {
|
||||
if (err) return next(err);
|
||||
res.json(MeasurementValidate.output(data.toObject()));
|
||||
|
Reference in New Issue
Block a user