clean util code
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
const api = require('@actual-app/api');
|
const api = require('@actual-app/api');
|
||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
|
|
||||||
module.exports = {
|
const Utils = {
|
||||||
openBudget: async function () {
|
openBudget: async function () {
|
||||||
process.on('unhandledRejection', (reason, p) => {
|
process.on('unhandledRejection', (reason, p) => {
|
||||||
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
||||||
@@ -130,15 +130,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getAccountNote: async function (account) {
|
getAccountNote: async function (account) {
|
||||||
const notes = await api.runQuery(
|
return Utils.getNote(`account-${account.id}`);
|
||||||
api.q('notes')
|
|
||||||
.filter({ id: `account-${account.id}` })
|
|
||||||
.select('*')
|
|
||||||
);
|
|
||||||
if (notes.data.length && notes.data[0].note) {
|
|
||||||
return notes.data[0].note;
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setAccountNote: async function (account, note) {
|
setAccountNote: async function (account, note) {
|
||||||
@@ -159,3 +151,5 @@ module.exports = {
|
|||||||
{ style: 'percent', maximumFractionDigits: 2 })
|
{ style: 'percent', maximumFractionDigits: 2 })
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = Utils;
|
||||||
|
|||||||
Reference in New Issue
Block a user