Skip to content

A local-first personal finance app

import category notes from nYNAB (#5461)

Matt Fiddaman9ebdba27fdbe
diff --git a/packages/desktop-client/e2e/data/ynab5-demo-budget.json b/packages/desktop-client/e2e/data/ynab5-demo-budget.json
index 384211e546..54ae0aa6c0 100644
--- a/packages/desktop-client/e2e/data/ynab5-demo-budget.json
+++ b/packages/desktop-client/e2e/data/ynab5-demo-budget.json
@@ -133,6 +133,7 @@
{
"id": "53c9d1fc-dc5b-4021-8255-463fa19065e4",
"name": "Bills",
+ "note": "Water, electric, rent etc.",
"hidden": false,
"deleted": false
},
@@ -252,7 +253,7 @@
"name": "Rent/Mortgage",
"hidden": false,
"original_category_group_id": null,
- "note": null,
+ "note": "Primary and secondary properties",
"budgeted": 0,
"activity": 0,
"balance": 0,
@@ -490,9 +491,9 @@
"id": "00ef54e0-fc17-455e-8d67-efb6327dc9d7",
"category_group_id": "857f9218-ddaa-495e-814d-0d72291a1d89",
"name": "Auto Maintenance",
+ "note": "### Cars\n- ABD123\n- 123ABC\n### Bike\n- A1B2C3",
"hidden": false,
"original_category_group_id": null,
- "note": null,
"budgeted": 0,
"activity": 0,
"balance": 0,
diff --git a/packages/loot-core/src/server/importers/ynab5-types.ts b/packages/loot-core/src/server/importers/ynab5-types.ts
index 1a9529e8b1..7a1f75ee8c 100644
--- a/packages/loot-core/src/server/importers/ynab5-types.ts
+++ b/packages/loot-core/src/server/importers/ynab5-types.ts
@@ -30,6 +30,7 @@ export interface CategoryGroup {
name: string;
deleted: boolean;
hidden: boolean;
+ note?: string;
}
export interface Category {
@@ -38,6 +39,7 @@ export interface Category {
name: string;
deleted: boolean;
hidden: boolean;
+ note?: string;
}
export interface Transaction {
diff --git a/packages/loot-core/src/server/importers/ynab5.ts b/packages/loot-core/src/server/importers/ynab5.ts
index a831234a94..b3dba76ca9 100644
--- a/packages/loot-core/src/server/importers/ynab5.ts
+++ b/packages/loot-core/src/server/importers/ynab5.ts
@@ -3,6 +3,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 { v4 as uuidv4 } from 'uuid';
@@ -93,6 +94,9 @@ async function importCategories(
hidden: group.hidden,
});
entityIdMap.set(group.id, groupId);
+ if (group.note) {
+ send('notes-save', { id: groupId, note: group.note });
+ }
run = false;
} catch (e) {
group.name = origName + '-' + count.toString();
@@ -141,6 +145,9 @@ async function importCategories(
hidden: cat.hidden,
});
entityIdMap.set(cat.id, id);
+ if (cat.note) {
+ send('notes-save', { id, note: cat.note });
+ }
run = false;
} catch (e) {
cat.name = origName + '-' + count.toString();
diff --git a/upcoming-release-notes/5461.md b/upcoming-release-notes/5461.md
new file mode 100644
index 0000000000..5e1123fc66
--- /dev/null
+++ b/upcoming-release-notes/5461.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [matt-fidd]
+---
+
+Import category notes from nYNAB