Feat: save cash balance notifications in DB

Feat: add "detail" row in notifications table migration

This makes searching for specific notifications in the
code like cashbox number easier because we don't need
to scrub the notification message column anymore to search
for notifications relating the cashbox 1 for example.

Feat: clear notifications on cash cassette balance update
This commit is contained in:
Cesar 2020-12-10 11:49:01 +00:00 committed by Josh Harvey
parent 2ced230020
commit 196a05549f
5 changed files with 64 additions and 6 deletions

View file

@ -9,6 +9,8 @@ const helper = require('./cash-out-helper')
const cashOutActions = require('./cash-out-actions')
const cashOutLow = require('./cash-out-low')
const notifier = require("../notifier/index")
const toObj = helper.toObj
module.exports = {atomic}
@ -122,8 +124,10 @@ function updateCassettes (t, tx) {
tx.deviceId
]
return t.one(sql, values)
.then(r => socket.emit(_.assign(r, {op: 'cassetteUpdate', deviceId: tx.deviceId})))
return t.one(sql, values).then(r => {
notifier.cashCassettesNotify(r, tx.deviceId)
return socket.emit(_.assign(r, {op: 'cassetteUpdate', deviceId: tx.deviceId}))
})
}
function wasJustAuthorized (oldTx, newTx, isZeroConf) {