add more db fields for fixed fee

This commit is contained in:
Josh Harvey 2017-05-19 01:34:09 +03:00
parent 8ecc8ce510
commit 8cdad0bc15
10 changed files with 74 additions and 65 deletions

View file

@ -21,7 +21,15 @@ function massage (tx) {
const transformDate = (v, k) => isDateField(k) ? new Date(v) : v
const mapValuesWithKey = _.mapValues.convert({'cap': false})
const transformDates = r => mapValuesWithKey(transformDate, r)
const mapBN = r => _.assign(r, {cryptoAtoms: BN(r.cryptoAtoms), fiat: BN(r.fiat)})
const mapBN = r => {
const update = r.direction === 'cashIn'
? {cryptoAtoms: BN(r.cryptoAtoms), fiat: BN(r.fiat), cashInFee: BN(r.cashInFee)}
: {cryptoAtoms: BN(r.cryptoAtoms), fiat: BN(r.fiat)}
return _.assign(r, update)
}
const mapper = _.flow(transformDates, mapBN, _.unset('dirty'))
return mapper(tx)