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

@ -55,32 +55,32 @@ function fetchPhoneTx (phone) {
const values = [phone, false, TRANSACTION_EXPIRATION]
return db.any(sql, values)
.then(_.map(toCashOutTx))
.then(txs => {
const confirmedTxs = txs.filter(tx => R.contains(tx.status, ['instant', 'confirmed']))
if (confirmedTxs.length > 0) {
const maxTx = R.reduce((acc, val) => {
return !acc || val.cryptoAtoms.gt(acc.cryptoAtoms) ? val : acc
}, null, confirmedTxs)
.then(_.map(toCashOutTx))
.then(txs => {
const confirmedTxs = txs.filter(tx => R.contains(tx.status, ['instant', 'confirmed']))
if (confirmedTxs.length > 0) {
const maxTx = R.reduce((acc, val) => {
return !acc || val.cryptoAtoms.gt(acc.cryptoAtoms) ? val : acc
}, null, confirmedTxs)
return maxTx
}
return maxTx
}
if (txs.length > 0) throw httpError('Pending transactions', 412)
throw httpError('No transactions', 404)
})
if (txs.length > 0) throw httpError('Pending transactions', 412)
throw httpError('No transactions', 404)
})
}
function fetchStatusTx (txId, status) {
const sql = 'select * from cash_out_txs where id=$1'
return db.oneOrNone(sql, [txId])
.then(toCashOutTx)
.then(tx => {
if (!tx) throw httpError('No transaction', 404)
if (tx.status === status) throw httpError('Not Modified', 304)
return tx
})
.then(toCashOutTx)
.then(tx => {
if (!tx) throw httpError('No transaction', 404)
if (tx.status === status) throw httpError('Not Modified', 304)
return tx
})
}
function updateDeviceConfigVersion (versionId) {
@ -105,9 +105,9 @@ function updateMachineDefaults (deviceId) {
}]
return settingsLoader.loadLatest()
.then(settings => {
return settingsLoader.save(settingsLoader.mergeValues(settings.config, newFields))
})
.then(settings => {
return settingsLoader.save(settingsLoader.mergeValues(settings.config, newFields))
})
}
module.exports = {