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.js
pull/4/head
AdamSBlack 2021-05-19 23:20:00 +01:00
parent 0e533fb494
commit a63d1914c8
2 changed files with 9 additions and 5 deletions

View File

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

View File

@ -27,7 +27,7 @@ module.exports = async (logger) => {
return {
db,
models: {
drivesModel: require('./drives')
drivesModel: require('./drives')(db)
}
}
}