Skip to content

Commit

Permalink
adding hidden property to category and categoryGroup for API models
Browse files Browse the repository at this point in the history
  • Loading branch information
ioslife committed Dec 11, 2023
1 parent b3bcff0 commit b611f3a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/loot-core/src/server/api-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const categoryModel = {
id: category.id,
name: category.name,
is_income: category.is_income ? true : false,
is_hidden: category.is_hidden ? true : false,
group_id: category.cat_group,
};
},
Expand All @@ -41,6 +42,9 @@ export const categoryModel = {
if ('is_income' in category) {
result.is_income = category.is_income ? 1 : 0;
}
if ('is_hidden' in category) {
result.hidden = category.is_hidden ? 1 : 0;
}
if ('group_id' in category) {
result.cat_group = category.group_id;
}
Expand All @@ -56,6 +60,7 @@ export const categoryGroupModel = {
id: group.id,
name: group.name,
is_income: group.is_income ? true : false,
is_hidden: group.is_hidden ? true : false,
categories: group.categories.map(categoryModel.toExternal),
};
},
Expand All @@ -65,6 +70,9 @@ export const categoryGroupModel = {
if ('is_income' in group) {
result.is_income = group.is_income ? 1 : 0;
}
if ('is_hidden' in group) {
result.hidden = group.is_hidden ? 1 : 0;
}
if ('categories' in group) {
result.categories = group.categories.map(categoryModel.fromExternal);
}
Expand Down

0 comments on commit b611f3a

Please sign in to comment.