Chore: balancesNotify refactor

This commit is contained in:
Cesar 2020-12-17 22:18:35 +00:00 committed by Josh Harvey
parent bf8a40026e
commit 016bd12113
4 changed files with 35 additions and 48 deletions

View file

@ -71,6 +71,12 @@ const addComplianceNotification = (deviceId, detail, message) => {
return db.oneOrNone(sql, [uuidv4(), detail, deviceId, message])
}
const batchInvalidate = (ids) => {
const formattedIds = _.map(pgp.as.text, ids).join(',')
const sql = `UPDATE notifications SET valid = 'f', read = 't' WHERE id IN ($1^)`
return db.none(sql, [formattedIds])
}
module.exports = {
machineEvents: dbm.machineEvents,
addNotification,