refactor: replace then chain with flow

This commit is contained in:
siiky 2022-12-16 17:00:28 +00:00 committed by Rafael
parent 7f2651fa9e
commit f010398ebf

View file

@ -62,11 +62,13 @@ function post (machineTx, pi) {
return postProcess(r, pi, isBlacklisted, addressReuse, walletScore)
.then(changes => _.set('walletScore', _.isNil(walletScore) ? null : walletScore.score, changes))
.then(changes => cashInLow.update(db, updatedTx, changes))
.then(tx => _.set('bills', machineTx.bills, tx))
.then(tx => _.set('blacklisted', isBlacklisted, tx))
.then(tx => _.set('blacklistMessage', blacklisted?.content, tx))
.then(tx => _.set('addressReuse', addressReuse, tx))
.then(tx => _.set('validWalletScore', _.isNil(walletScore) ? true : walletScore.isValid, tx))
.then(_.flow(
_.set('bills', machineTx.bills),
_.set('blacklisted', isBlacklisted),
_.set('blacklistMessage', blacklisted?.content),
_.set('addressReuse', addressReuse),
_.set('validWalletScore', _.isNil(walletScore) ? true : walletScore.isValid),
))
})
})
}