DB connection is now established in /models/index and is passed back to server.js until all db calls are moved into their own model.
> passing db connection to models/drives.jspull/4/head
parent
0e533fb494
commit
a63d1914c8
|
@ -1,7 +1,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
let db;
|
||||
|
||||
function getDrives(dongleId) {
|
||||
|
||||
|
@ -18,7 +18,11 @@ async function deviceCheckIn(dongleId) {
|
|||
);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getDevice,
|
||||
deviceCheckIn
|
||||
module.exports = (_db) => {
|
||||
db = _db;
|
||||
|
||||
return {
|
||||
getDevice,
|
||||
deviceCheckIn
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ module.exports = async (logger) => {
|
|||
return {
|
||||
db,
|
||||
models: {
|
||||
drivesModel: require('./drives')
|
||||
drivesModel: require('./drives')(db)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue