Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const computeBankAccountStats = async () => {
log('info', 'Fetching settings...')
let setting = await Settings.fetchWithDefault()
// The flag is needed to use local model when getting a transaction category ID
flag('local-model-override', setting.community.localModelOverride.enabled)
const stats = await BankAccountStats.fetchAll()
const statsByAccountId = keyBy(
stats,
stat => stat.relationships.account.data._id
)
const period = getPeriod()
const transactions = await fetchTransactionsForPeriod(period)
log(
'info',
`${transactions.length} transactions between ${period.start} and ${period.end}`
)
const transactionsByAccount = groupBy(
transactions,
transaction => transaction.account