feat: add operatorId to l-a-s middlewares

fix: make changes to db event handler to receive more complex payloads
feat: machine actions previously on REST now work based on notifications
feat: state middleware now operates based on operatorId as well
chore: remove old localAppRoutes related code
This commit is contained in:
Sérgio Salgado 2021-09-17 16:57:28 +01:00
parent 32e5b1ba87
commit 7135a03654
11 changed files with 71 additions and 78 deletions

View file

@ -8,6 +8,7 @@ const { getCashInSettings } = require('../new-config-manager')
const { AUTOMATIC } = require('../constants.js')
function notifyCashboxRemoval (req, res, next) {
const operatorId = res.locals.operatorId
return Promise.all([getMachine(req.deviceId), loadLatestConfig()])
.then(([machine, config]) => {
const cashInSettings = getCashInSettings(config)
@ -15,7 +16,7 @@ function notifyCashboxRemoval (req, res, next) {
return res.status(200).send({ status: 'OK' })
}
return cashbox.createCashboxBatch(req.deviceId, machine.cashbox)
.then(() => setMachine({ deviceId: req.deviceId, action: 'emptyCashInBills' }))
.then(() => setMachine({ deviceId: req.deviceId, action: 'emptyCashInBills' }, operatorId))
.then(() => res.status(200).send({ status: 'OK' }))
})
.catch(next)