Revert "Use API getAccountBalance"

This reverts commit aca6e0145b.
This commit is contained in:
Robert Dyer
2024-08-24 14:48:55 -05:00
parent a1310abe21
commit afb3df018e
6 changed files with 23 additions and 10 deletions
+13
View File
@@ -41,6 +41,19 @@ const Utils = {
}
},
getAccountBalance: async function (account, cutoffDate=new Date()) {
const data = await api.runQuery(
api.q('transactions')
.filter({
'account': account.id,
'date': { $lt: cutoffDate },
})
.calculate({ $sum: '$amount' })
.options({ splits: 'grouped' })
);
return data.data;
},
getTransactions: async function (account) {
const data = await api.runQuery(
api.q('transactions')