WIPP unpairing
This commit is contained in:
parent
134a016bbd
commit
e537033319
4 changed files with 226 additions and 4049 deletions
|
|
@ -1,4 +1,5 @@
|
|||
const db = require('../db')
|
||||
const pairing = require('./pairing')
|
||||
|
||||
function getMachines () {
|
||||
return db.any('select * from devices where display=TRUE order by name')
|
||||
|
|
@ -17,9 +18,20 @@ function resetCashOutBills (rec) {
|
|||
return db.none(sql, [rec.cassettes[0], rec.cassettes[1], rec.deviceId])
|
||||
}
|
||||
|
||||
function unpair (rec) {
|
||||
return pairing.unpair(rec.deviceId)
|
||||
}
|
||||
|
||||
function repair (rec) {
|
||||
return pairing.repair(rec.deviceId)
|
||||
}
|
||||
|
||||
function setMachine (rec) {
|
||||
switch (rec.action) {
|
||||
case 'resetCashOutBills': return resetCashOutBills(rec)
|
||||
case 'unpair': return unpair(rec)
|
||||
case 'repair': return repair(rec)
|
||||
default: throw new Error('No such action: ' + rec.action)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@ function unpair (deviceId) {
|
|||
return db.none(sql, [deviceId])
|
||||
}
|
||||
|
||||
function repair (deviceId) {
|
||||
const sql = 'update devices set paired=TRUE where device_id=$1'
|
||||
|
||||
return db.none(sql, [deviceId])
|
||||
}
|
||||
|
||||
function totem (hostname, name) {
|
||||
const caPath = options.caPath
|
||||
|
||||
|
|
@ -29,4 +35,4 @@ function totem (hostname, name) {
|
|||
})
|
||||
}
|
||||
|
||||
module.exports = {totem, unpair}
|
||||
module.exports = {totem, unpair, repair}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue