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

@ -99,7 +99,10 @@ function renameMachine (rec) {
}
function resetCashOutBills (rec) {
const sql = 'update devices set cassette1=$1, cassette2=$2 where device_id=$3'
const sql = `
update devices set cassette1=$1, cassette2=$2 where device_id=$3;
update notifications set read = 't' where device_id = $3 AND type = 'fiatBalance' AND read = 'f';
`
return db.none(sql, [rec.cassettes[0], rec.cassettes[1], rec.deviceId])
}