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

@ -1,5 +1,7 @@
const _ = require('lodash/fp')
const crypto = require('crypto')
const numeral = require('numeral')
const prettyMs = require('pretty-ms')
const coinUtils = require('../coin-utils')
const {
@ -143,6 +145,14 @@ const buildTransactionMessage = (tx, rec, highValueTx, machineName, customer) =>
}, highValueTx]
}
function formatCurrency(num, code) {
return numeral(num).format('0,0.00') + ' ' + code
}
function formatAge (age, settings) {
return prettyMs(age, settings)
}
module.exports = {
codeDisplay,
parseEventNote,
@ -155,5 +165,7 @@ module.exports = {
shouldNotAlert,
buildAlertFingerprint,
sendNoAlerts,
buildTransactionMessage
buildTransactionMessage,
formatCurrency,
formatAge
}