Feat: crypto balance notifications saving in DB

Chore: add new column "detail" to transactions table migration

Feat: check if older notification is valid before sending new one

Feat: error saving to database

Fix: fix error when invalidating notification on
clearCryptoBalanceNotifications
Chre: code refactor in new-settings-loader for simplicity
Chore: refactor code on notifier and merge similar functions
This commit is contained in:
Cesar 2020-12-10 18:26:13 +00:00 committed by Josh Harvey
parent 196a05549f
commit 3b3bdf839b
9 changed files with 224 additions and 34 deletions

View file

@ -27,20 +27,31 @@ function printSmsAlerts(alertRec, config) {
const code = entry[0]
const machineNames = _.filter(
_.negate(_.isEmpty),
_.map('machineName', entry[1])
_.map('machineName', entry[1]),
)
const cryptoCodes = _.filter(
_.negate(_.isEmpty),
_.map('cryptoCode', entry[1]),
)
return {
codeDisplay: utils.codeDisplay(code),
machineNames
machineNames,
cryptoCodes
}
}, _.toPairs(alertsMap))
const mapByCodeDisplay = _.map(it =>
_.isEmpty(it.machineNames)
? it.codeDisplay
: `${it.codeDisplay} (${it.machineNames.join(', ')})`
)
const mapByCodeDisplay = _.map(it => {
if(_.isEmpty(it.machineNames) && _.isEmpty(it.cryptoCodes)) {
return it.codeDisplay
}
if(_.isEmpty(it.machineNames)) {
return `${it.codeDisplay} (${it.cryptoCodes.join(', ')})`
}
else return `${it.codeDisplay} (${it.machineNames.join(', ')})`
})
const displayAlertTypes = _.compose(
_.uniq,