mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
More features
This commit is contained in:
@ -32,7 +32,6 @@ exports.get = function(req, res, next) {
|
||||
|
||||
Device.findById(id)
|
||||
.populate('deviceType', 'category make model checkList')
|
||||
.populate('deviceType.checkList', 'name fields')
|
||||
.populate('client', 'name identifier')
|
||||
.exec(returnResult(res));
|
||||
};
|
||||
|
@ -115,6 +115,15 @@ module.exports = function(config) {
|
||||
}
|
||||
|
||||
testRun.save(returnResult(res));
|
||||
|
||||
Device.findById(testRun.device, function(err, device) {
|
||||
if (err) {
|
||||
log.error("Failed to fetch device for testRun: %s", err);
|
||||
} else {
|
||||
device.lastTestRun = testRun;
|
||||
device.save();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
update: function(req, res, next) {
|
||||
|
@ -108,12 +108,12 @@ module.exports = function(config, calendar) {
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
Device.find({client: req.body.client, deleted: false })
|
||||
.populate({path: 'deviceType'})
|
||||
.exec(function(err, results) {
|
||||
devices = results;
|
||||
callback(err);
|
||||
});
|
||||
Device.find({'_id': { $in: req.body.devices }})
|
||||
.populate({path: 'deviceType'})
|
||||
.exec(function(err, results) {
|
||||
devices = results;
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
User.find({
|
||||
|
@ -13,6 +13,7 @@ var deviceSchema = new Schema({
|
||||
location: String,
|
||||
frequencyType: String,
|
||||
frequencySchedule: [],
|
||||
lastTestRun: {},
|
||||
deleted: { type: Boolean, default: false }
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user