Chore: refactor to use new schema changing queries
This commit is contained in:
parent
304f792484
commit
e6059be8d2
44 changed files with 185 additions and 171 deletions
|
|
@ -3,7 +3,7 @@ const notifierQueries = require('./notifier/queries')
|
|||
|
||||
// Get all blacklist rows from the DB "blacklist" table that were manually inserted by the operator
|
||||
const getBlacklist = () => {
|
||||
return db.any(`SELECT * FROM blacklist`).then(res =>
|
||||
return db.$any(`SELECT * FROM blacklist`).then(res =>
|
||||
res.map(item => ({
|
||||
cryptoCode: item.crypto_code,
|
||||
address: item.address
|
||||
|
|
@ -15,12 +15,12 @@ const getBlacklist = () => {
|
|||
const deleteFromBlacklist = (cryptoCode, address) => {
|
||||
const sql = `DELETE FROM blacklist WHERE crypto_code = $1 AND address = $2`
|
||||
notifierQueries.clearBlacklistNotification(cryptoCode, address)
|
||||
return db.none(sql, [cryptoCode, address])
|
||||
return db.$none(sql, [cryptoCode, address])
|
||||
}
|
||||
|
||||
const insertIntoBlacklist = (cryptoCode, address) => {
|
||||
return db
|
||||
.none(
|
||||
.$none(
|
||||
'INSERT INTO blacklist (crypto_code, address) VALUES ($1, $2);',
|
||||
[cryptoCode, address]
|
||||
)
|
||||
|
|
@ -28,7 +28,7 @@ const insertIntoBlacklist = (cryptoCode, address) => {
|
|||
|
||||
function blocked (address, cryptoCode) {
|
||||
const sql = `SELECT * FROM blacklist WHERE address = $1 AND crypto_code = $2`
|
||||
return db.any(sql, [address, cryptoCode])
|
||||
return db.$any(sql, [address, cryptoCode])
|
||||
}
|
||||
|
||||
function addToUsedAddresses (address, cryptoCode) {
|
||||
|
|
@ -36,7 +36,7 @@ function addToUsedAddresses (address, cryptoCode) {
|
|||
if (cryptoCode === 'ETH') return Promise.resolve()
|
||||
|
||||
const sql = `INSERT INTO blacklist (crypto_code, address) VALUES ($1, $2)`
|
||||
return db.oneOrNone(sql, [cryptoCode, address])
|
||||
return db.$oneOrNone(sql, [cryptoCode, address])
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue