Files
biomedjs/config/db.js
Dobie Wollert 977ea41cef more bits
2015-12-20 23:44:49 -08:00

32 lines
453 B
JavaScript

'use strict';
const mongoose = require('mongoose');
const models = [
'CheckList',
'Client',
'Counter',
'Device',
'DeviceType',
'Pm',
'Post',
'Tag',
'TestRun',
'TimeClockException',
'TimeClockSpan',
'TimeSheet',
'User',
'Workorder'
];
module.exports = function() {
return function(req, res, next) {
req.db = {};
models.forEach((model) => {
req.db[model] = mongoose.model(model);
});
next();
}
};