[PR #4544] [MERGED] Replace category DB queries in server handlers with AQL queries + implement category_groups AQL executor #67811

Closed
opened 2026-05-14 02:17:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/4544
Author: @joel-jeremy
Created: 3/5/2025
Status: ✅ Merged
Merged: 4/8/2025
Merged by: @joel-jeremy

Base: master ← Head: aql-category-groups


📝 Commits (4)

  • 6268574 Implement category_groups AQL executor
  • ebd4934 Fix category_groups table name
  • 90f7a9c Release notes
  • d161378 Update category-update

📊 Changes

23 files changed (+167 additions, -85 deletions)

View changed files

📝 packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (+8 -5)
📝 packages/desktop-client/src/components/budget/BudgetCategories.jsx (+1 -1)
📝 packages/desktop-client/src/components/budget/ExpenseCategory.tsx (+1 -1)
📝 packages/desktop-client/src/components/budget/index.tsx (+2 -2)
📝 packages/desktop-client/src/components/budget/util.ts (+3 -7)
📝 packages/desktop-client/src/components/mobile/budget/IncomeCategoryList.tsx (+3 -3)
📝 packages/desktop-client/src/components/modals/CategoryMenuModal.tsx (+1 -1)
📝 packages/desktop-client/src/components/reports/ReportOptions.ts (+6 -8)
📝 packages/loot-core/src/mocks/budget.ts (+4 -2)
📝 packages/loot-core/src/mocks/index.ts (+9 -3)
📝 packages/loot-core/src/server/api-models.ts (+7 -8)
📝 packages/loot-core/src/server/api.ts (+3 -3)
📝 packages/loot-core/src/server/aql/schema/executors.ts (+70 -0)
📝 packages/loot-core/src/server/aql/schema/index.ts (+4 -0)
📝 packages/loot-core/src/server/budget/app.ts (+5 -1)
📝 packages/loot-core/src/server/budget/base.ts (+7 -2)
📝 packages/loot-core/src/server/budget/goalsSchedule.test.ts (+3 -2)
📝 packages/loot-core/src/server/db/index.ts (+14 -3)
📝 packages/loot-core/src/server/importers/ynab5.ts (+5 -6)
📝 packages/loot-core/src/server/models.ts (+2 -20)

...and 3 more files

📄 Description

Right now there is a mismatch between the AQL schema and the CategoryEntity model. The schema defines a group property but the CategoryEntity defined a cat_group property. This PR is to align the two and modify the entity model to match the schema.

I have also updated the server handlers to use AQL to query categories so that we avoid directly returning the DB models to the client side.

A new AQL executor is also added for category_groups to quickly filter out categories if needed via the categories query option (similar to how transactions query have the splits option).
Example:

// Returns groups with categories included. This is default behavior.
aqlQuery(q('category_groups').options({ categories: 'all' }).select('*'))

// Returns groups without categories.
aqlQuery(q('category_groups').options({ categories: 'none' }).select('*'))

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/4544 **Author:** [@joel-jeremy](https://github.com/joel-jeremy) **Created:** 3/5/2025 **Status:** ✅ Merged **Merged:** 4/8/2025 **Merged by:** [@joel-jeremy](https://github.com/joel-jeremy) **Base:** `master` ← **Head:** `aql-category-groups` --- ### 📝 Commits (4) - [`6268574`](https://github.com/actualbudget/actual/commit/6268574df687b6b1f7994aaba927622303478eda) Implement category_groups AQL executor - [`ebd4934`](https://github.com/actualbudget/actual/commit/ebd49346af2fe96a4f34838d6cb76c5ca2f6a0dd) Fix category_groups table name - [`90f7a9c`](https://github.com/actualbudget/actual/commit/90f7a9ce5fe72d5524c5a7dc1884ecb61d79fbd1) Release notes - [`d161378`](https://github.com/actualbudget/actual/commit/d161378b21094484e1cf92323bfb2348ae019239) Update category-update ### 📊 Changes **23 files changed** (+167 additions, -85 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx` (+8 -5) 📝 `packages/desktop-client/src/components/budget/BudgetCategories.jsx` (+1 -1) 📝 `packages/desktop-client/src/components/budget/ExpenseCategory.tsx` (+1 -1) 📝 `packages/desktop-client/src/components/budget/index.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/budget/util.ts` (+3 -7) 📝 `packages/desktop-client/src/components/mobile/budget/IncomeCategoryList.tsx` (+3 -3) 📝 `packages/desktop-client/src/components/modals/CategoryMenuModal.tsx` (+1 -1) 📝 `packages/desktop-client/src/components/reports/ReportOptions.ts` (+6 -8) 📝 `packages/loot-core/src/mocks/budget.ts` (+4 -2) 📝 `packages/loot-core/src/mocks/index.ts` (+9 -3) 📝 `packages/loot-core/src/server/api-models.ts` (+7 -8) 📝 `packages/loot-core/src/server/api.ts` (+3 -3) 📝 `packages/loot-core/src/server/aql/schema/executors.ts` (+70 -0) 📝 `packages/loot-core/src/server/aql/schema/index.ts` (+4 -0) 📝 `packages/loot-core/src/server/budget/app.ts` (+5 -1) 📝 `packages/loot-core/src/server/budget/base.ts` (+7 -2) 📝 `packages/loot-core/src/server/budget/goalsSchedule.test.ts` (+3 -2) 📝 `packages/loot-core/src/server/db/index.ts` (+14 -3) 📝 `packages/loot-core/src/server/importers/ynab5.ts` (+5 -6) 📝 `packages/loot-core/src/server/models.ts` (+2 -20) _...and 3 more files_ </details> ### 📄 Description <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes --> Right now there is a mismatch between the AQL schema and the `CategoryEntity` model. The schema defines a `group` property but the `CategoryEntity` defined a `cat_group` property. This PR is to align the two and modify the entity model to match the schema. I have also updated the server handlers to use AQL to query categories so that we avoid directly returning the DB models to the client side. A new AQL executor is also added for category_groups to quickly filter out categories if needed via the `categories` query option (similar to how transactions query have the `splits` option). Example: ```typescript // Returns groups with categories included. This is default behavior. aqlQuery(q('category_groups').options({ categories: 'all' }).select('*')) // Returns groups without categories. aqlQuery(q('category_groups').options({ categories: 'none' }).select('*')) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-14 02:17:23 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#67811