chore: undo $ prepend on queries

This commit is contained in:
Taranto 2021-07-22 11:06:39 +01:00 committed by Josh Harvey
parent f3f2bb01b0
commit ba4117173e
50 changed files with 215 additions and 227 deletions

View file

@ -5,11 +5,11 @@ var psqlUrl = require('../lib/options').postgresql
var db = pgp(psqlUrl)
db.$manyOrNone(`select * from transactions where incoming=false
db.manyOrNone(`select * from transactions where incoming=false
and stage='final_request' and authority='machine'`)
.then(rs =>
db.tx(t =>
t.batch(rs.map(r => db.$none(`insert into cash_in_txs (session_id,
t.batch(rs.map(r => db.none(`insert into cash_in_txs (session_id,
device_fingerprint, to_address, crypto_atoms, crypto_code, fiat,
currency_code, fee, tx_hash, error, created) values ($1, $2, $3, $4, $5,
$6, $7, $8, $9, $10, $11)`, [r.session_id, r.device_fingerprint,
@ -18,11 +18,11 @@ db.$manyOrNone(`select * from transactions where incoming=false
)
)
)
.then(() => db.$manyOrNone(`select * from transactions where incoming=true
.then(() => db.manyOrNone(`select * from transactions where incoming=true
and stage='initial_request' and authority='pending'`))
.then(rs =>
db.tx(t =>
t.batch(rs.map(r => db.$none(`insert into cash_out_txs (session_id,
t.batch(rs.map(r => db.none(`insert into cash_out_txs (session_id,
device_fingerprint, to_address, crypto_atoms, crypto_code, fiat,
currency_code, tx_hash, phone, error, created) values ($1, $2, $3, $4, $5,
$6, $7, $8, $9, $10, $11)`, [r.session_id, r.device_fingerprint,
@ -31,13 +31,13 @@ db.$manyOrNone(`select * from transactions where incoming=false
)
)
)
.then(() => db.$manyOrNone(`select * from transactions where incoming=true
.then(() => db.manyOrNone(`select * from transactions where incoming=true
and stage='dispense' and authority='authorized'`))
.then(rs =>
db.tx(t =>
t.batch(rs.map(r =>
db.$none(`update cash_out_txs set dispensed=true where session_id=$1`, [r.session_id])
.then(() => db.$none(`insert into cash_out_actions (session_id, action,
db.none(`update cash_out_txs set dispensed=true where session_id=$1`, [r.session_id])
.then(() => db.none(`insert into cash_out_actions (session_id, action,
created) values ($1, $2, $3)`, [r.session_id, 'dispensed', r.created]))
))
)