mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 12:43:09 -05:00
nYNAB import - properly handle hidden categories and groups (#4294)
* add error handler * lint * note * rabbit * handle groups * handle hidden right * cleanup mock file * lint;note
This commit is contained in:
@@ -165,9 +165,39 @@
|
||||
"name": "Hidden Categories",
|
||||
"hidden": false,
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": "F5751985-3290-41E7-B17F-6DBE979F315D",
|
||||
"name": "Bills",
|
||||
"hidden": true,
|
||||
"deleted": false
|
||||
}
|
||||
],
|
||||
"categories": [
|
||||
{
|
||||
"id": "36120000-6c61-4402-985a-891a8d267858",
|
||||
"category_group_id": "F5751985-3290-41E7-B17F-6DBE979F315D",
|
||||
"name": "Under extra Bills",
|
||||
"hidden": false,
|
||||
"original_category_group_id": null,
|
||||
"note": null,
|
||||
"budgeted": 0,
|
||||
"activity": 0,
|
||||
"balance": 0,
|
||||
"goal_type": null,
|
||||
"goal_day": null,
|
||||
"goal_cadence": null,
|
||||
"goal_cadence_frequency": null,
|
||||
"goal_creation_month": null,
|
||||
"goal_target": 0,
|
||||
"goal_target_month": null,
|
||||
"goal_percentage_complete": null,
|
||||
"goal_months_to_budget": null,
|
||||
"goal_under_funded": null,
|
||||
"goal_overall_funded": null,
|
||||
"goal_overall_left": null,
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": "36120d44-6c61-4402-985a-891a8d267858",
|
||||
"category_group_id": "d5c355c2-3b77-4a7f-b8b3-c832b10cfec9",
|
||||
@@ -240,6 +270,30 @@
|
||||
"goal_overall_left": null,
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": "54280000-b567-4cff-8a94-d9d65491990f",
|
||||
"category_group_id": "53c9d1fc-dc5b-4021-8255-463fa19065e4",
|
||||
"name": "Sneaky Category",
|
||||
"hidden": true,
|
||||
"original_category_group_id": null,
|
||||
"note": null,
|
||||
"budgeted": 0,
|
||||
"activity": 0,
|
||||
"balance": 0,
|
||||
"goal_type": "NEED",
|
||||
"goal_day": null,
|
||||
"goal_cadence": 1,
|
||||
"goal_cadence_frequency": 1,
|
||||
"goal_creation_month": null,
|
||||
"goal_target": 0,
|
||||
"goal_target_month": null,
|
||||
"goal_percentage_complete": null,
|
||||
"goal_months_to_budget": null,
|
||||
"goal_under_funded": null,
|
||||
"goal_overall_funded": null,
|
||||
"goal_overall_left": null,
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": "ca7f02c3-7801-4a5a-a07d-ab90ca1e6360",
|
||||
"category_group_id": "53c9d1fc-dc5b-4021-8255-463fa19065e4",
|
||||
@@ -576,6 +630,30 @@
|
||||
"goal_overall_left": null,
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": "6a45b700-0624-4673-a705-830732976846",
|
||||
"category_group_id": "ce2bff41-c8a3-4845-b14d-3f72f48075ed",
|
||||
"name": "Hobbies",
|
||||
"hidden": true,
|
||||
"original_category_group_id": null,
|
||||
"note": null,
|
||||
"budgeted": 0,
|
||||
"activity": 0,
|
||||
"balance": 0,
|
||||
"goal_type": "NEED",
|
||||
"goal_day": null,
|
||||
"goal_cadence": 1,
|
||||
"goal_cadence_frequency": 1,
|
||||
"goal_creation_month": null,
|
||||
"goal_target": 0,
|
||||
"goal_target_month": null,
|
||||
"goal_percentage_complete": null,
|
||||
"goal_months_to_budget": null,
|
||||
"goal_under_funded": null,
|
||||
"goal_overall_funded": null,
|
||||
"goal_overall_left": null,
|
||||
"deleted": false
|
||||
},
|
||||
{
|
||||
"id": "0431a8df-183f-4820-acc4-255138918710",
|
||||
"category_group_id": "ce2bff41-c8a3-4845-b14d-3f72f48075ed",
|
||||
|
||||
@@ -628,7 +628,10 @@ handlers['api/category-group-create'] = withMutation(async function ({
|
||||
group,
|
||||
}) {
|
||||
checkFileOpen();
|
||||
return handlers['category-group-create']({ name: group.name });
|
||||
return handlers['category-group-create']({
|
||||
name: group.name,
|
||||
hidden: group.hidden,
|
||||
});
|
||||
});
|
||||
|
||||
handlers['api/category-group-update'] = withMutation(async function ({
|
||||
|
||||
@@ -30,6 +30,7 @@ export namespace YNAB5 {
|
||||
id: string;
|
||||
name: string;
|
||||
deleted: boolean;
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
interface Category {
|
||||
@@ -37,6 +38,7 @@ export namespace YNAB5 {
|
||||
category_group_id: string;
|
||||
name: string;
|
||||
deleted: boolean;
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
interface Transaction {
|
||||
|
||||
@@ -91,6 +91,7 @@ async function importCategories(
|
||||
groupId = await actual.createCategoryGroup({
|
||||
name: group.name,
|
||||
is_income: false,
|
||||
hidden: group.hidden,
|
||||
});
|
||||
entityIdMap.set(group.id, groupId);
|
||||
run = false;
|
||||
@@ -138,6 +139,7 @@ async function importCategories(
|
||||
const id = await actual.createCategory({
|
||||
name: cat.name,
|
||||
group_id: groupId,
|
||||
hidden: cat.hidden,
|
||||
});
|
||||
entityIdMap.set(cat.id, id);
|
||||
run = false;
|
||||
|
||||
@@ -371,11 +371,13 @@ handlers['get-category-groups'] = async function () {
|
||||
handlers['category-group-create'] = mutator(async function ({
|
||||
name,
|
||||
isIncome,
|
||||
hidden,
|
||||
}) {
|
||||
return withUndo(async () => {
|
||||
return db.insertCategoryGroup({
|
||||
name,
|
||||
is_income: isIncome ? 1 : 0,
|
||||
hidden,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -93,6 +93,7 @@ export interface ServerHandlers {
|
||||
'category-group-create': (arg: {
|
||||
name;
|
||||
isIncome?: boolean;
|
||||
hidden?: boolean;
|
||||
}) => Promise<string>;
|
||||
|
||||
'category-group-update': (group) => Promise<unknown>;
|
||||
|
||||
6
upcoming-release-notes/4294.md
Normal file
6
upcoming-release-notes/4294.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Enhancements
|
||||
authors: [youngcw]
|
||||
---
|
||||
|
||||
Properly handle nynab hidden categories/groups on import
|
||||
Reference in New Issue
Block a user