Skip to content

A local-first personal finance app

Import category notes from YNAB4 exports (#1515)

Johannes Löthberg71f885b8997f
diff --git a/packages/loot-core/src/server/importers/ynab4-types.d.ts b/packages/loot-core/src/server/importers/ynab4-types.d.ts
index 72cf81483c..931f175540 100644
--- a/packages/loot-core/src/server/importers/ynab4-types.d.ts
+++ b/packages/loot-core/src/server/importers/ynab4-types.d.ts
@@ -16,6 +16,7 @@ export namespace YNAB4 {
export interface MasterCategory {
entityType: string;
expanded: boolean;
+ note?: string;
name: string;
type: string;
deleteable: boolean;
@@ -31,6 +32,7 @@ export namespace YNAB4 {
export interface SubCategory {
entityType: string;
name: string;
+ note?: string;
type: string;
// cachedBalance: null;
masterCategoryId: string;
diff --git a/packages/loot-core/src/server/importers/ynab4.ts b/packages/loot-core/src/server/importers/ynab4.ts
index 9286464dd8..bc314b644d 100644
--- a/packages/loot-core/src/server/importers/ynab4.ts
+++ b/packages/loot-core/src/server/importers/ynab4.ts
@@ -2,6 +2,7 @@
// into Actual itself. We only want to pull in the methods in that
// case and ignore everything else; otherwise we'd be pulling in the
// entire backend bundle from the API
+import { send } from '@actual-app/api/injected';
import * as actual from '@actual-app/api/methods';
import { amountToInteger } from '@actual-app/api/utils';
import AdmZip from 'adm-zip';
@@ -54,6 +55,9 @@ async function importCategories(
is_income: false,
});
entityIdMap.set(masterCategory.entityId, id);
+ if (masterCategory.note) {
+ send('notes-save', { id, note: masterCategory.note });
+ }
if (masterCategory.subCategories) {
const subCategories = sortByKey(
@@ -71,6 +75,9 @@ async function importCategories(
group_id: entityIdMap.get(category.masterCategoryId),
});
entityIdMap.set(category.entityId, id);
+ if (category.note) {
+ send('notes-save', { id, note: category.note });
+ }
}
}
}
diff --git a/upcoming-release-notes/1515.md b/upcoming-release-notes/1515.md
new file mode 100644
index 0000000000..0d93f74232
--- /dev/null
+++ b/upcoming-release-notes/1515.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [kyrias]
+---
+
+Import category notes from YNAB4 exports.