format for latest standard

This commit is contained in:
Josh Harvey 2018-03-10 18:59:40 +00:00
parent 4108efd9c7
commit c2af183911
77 changed files with 1697 additions and 1693 deletions

View file

@ -14,11 +14,11 @@ module.exports = {upsert, update, insert}
function upsert (t, oldTx, tx) {
if (!oldTx) {
return insert(t, tx)
.then(newTx => [oldTx, newTx])
.then(newTx => [oldTx, newTx])
}
return update(t, tx, diff(oldTx, tx))
.then(newTx => [oldTx, newTx])
.then(newTx => [oldTx, newTx])
}
function insert (t, tx) {
@ -26,7 +26,7 @@ function insert (t, tx) {
const sql = pgp.helpers.insert(dbTx, null, 'cash_out_txs') + ' returning *'
return t.one(sql)
.then(toObj)
.then(toObj)
}
function update (t, tx, changes) {
@ -39,7 +39,7 @@ function update (t, tx, changes) {
const newTx = _.merge(tx, changes)
return t.none(sql)
.then(() => newTx)
.then(() => newTx)
}
function diff (oldTx, newTx) {