clean util code

This commit is contained in:
Robert Dyer
2024-08-07 07:57:27 -05:00
parent 25b499263f
commit 7e8cb82437
+4 -10
View File
@@ -1,7 +1,7 @@
const api = require('@actual-app/api');
require("dotenv").config();
module.exports = {
const Utils = {
openBudget: async function () {
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
@@ -130,15 +130,7 @@ module.exports = {
},
getAccountNote: async function (account) {
const notes = await api.runQuery(
api.q('notes')
.filter({ id: `account-${account.id}` })
.select('*')
);
if (notes.data.length && notes.data[0].note) {
return notes.data[0].note;
}
return undefined;
return Utils.getNote(`account-${account.id}`);
},
setAccountNote: async function (account, note) {
@@ -159,3 +151,5 @@ module.exports = {
{ style: 'percent', maximumFractionDigits: 2 })
},
};
module.exports = Utils;