Feat: change column "detail" in database to use jsonb
This commit is contained in:
parent
82916388a0
commit
c16e47af96
3 changed files with 73 additions and 51 deletions
|
|
@ -77,6 +77,16 @@ const batchInvalidate = (ids) => {
|
|||
return db.none(sql, [formattedIds])
|
||||
}
|
||||
|
||||
const clearBlacklistNotification = (cryptoCode, cryptoAddress) => {
|
||||
const sql = `UPDATE notifications SET valid = 'f', read = 't' WHERE type = 'compliance' AND detail->>'cryptoCode' = $1 AND detail->>'cryptoAddress' = $2 AND (detail->>'code' = 'BLOCKED' OR detail->>'code' = 'REUSED')`
|
||||
return db.none(sql, [cryptoCode, cryptoAddress])
|
||||
}
|
||||
|
||||
const getValidNotifications = (type, detail) => {
|
||||
const sql = `SELECT * FROM notifications where type = $1 AND valid = 't' AND detail @> $2`
|
||||
return db.any(sql, [type, detail])
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
machineEvents: dbm.machineEvents,
|
||||
addNotification,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue