Chore: balancesNotify refactor
This commit is contained in:
parent
bf8a40026e
commit
016bd12113
4 changed files with 35 additions and 48 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue