Create support_logs (db & api)
This commit is contained in:
parent
b7d6f3f419
commit
62d606cc80
8 changed files with 279 additions and 58 deletions
|
|
@ -6,7 +6,7 @@ const pairing = require('./pairing')
|
|||
const configManager = require('./config-manager')
|
||||
const settingsLoader = require('./settings-loader')
|
||||
|
||||
module.exports = {getMachines, getMachineNames, setMachine}
|
||||
module.exports = {getMachineName, getMachines, getMachineNames, setMachine}
|
||||
|
||||
function getMachines () {
|
||||
return db.any('select * from devices where display=TRUE order by created')
|
||||
|
|
@ -40,6 +40,24 @@ function getMachineNames (config) {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the machine id, get the machine name
|
||||
*
|
||||
* @name getMachineName
|
||||
* @function
|
||||
* @async
|
||||
*
|
||||
* @param {string} machineId machine id
|
||||
* @returns {string} machine name
|
||||
*/
|
||||
function getMachineName (machineId) {
|
||||
return settingsLoader.loadRecentConfig()
|
||||
.then(config => {
|
||||
const machineScoped = configManager.machineScoped(machineId, config)
|
||||
return machineScoped.machineName
|
||||
})
|
||||
}
|
||||
|
||||
function resetCashOutBills (rec) {
|
||||
const sql = 'update devices set cassette1=$1, cassette2=$2 where device_id=$3'
|
||||
return db.none(sql, [rec.cassettes[0], rec.cassettes[1], rec.deviceId])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue