[PR #2568] [MERGED] Add API for working with rules #18736

Closed
opened 2026-04-14 20:50:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/2568
Author: @psybers
Created: 4/8/2024
Status: Merged
Merged: 5/14/2024
Merged by: @youngcw

Base: masterHead: rules-api


📝 Commits (10+)

  • 3d15ae3 Add API for working with rules
  • 59f6092 Add release note
  • 945bb71 Change 'payees-get-rules' return type to RuleEntity[]
  • fe4c3d4 Reuse existing handlers, make names not have 'payee', add two getters
  • 409ff1d fix linter
  • 2daa387 fix bad handler name
  • ed1e0ab fix broken handler name
  • 1196a8b add test cases for 'getPayeeRules'
  • 5b3f099 fix broken test
  • 5bc4df9 Remove unused locals

📊 Changes

11 files changed (+299 additions, -13 deletions)

View changed files

📝 packages/api/methods.test.ts (+208 -0)
📝 packages/api/methods.ts (+20 -0)
📝 packages/desktop-client/src/components/ManageRules.tsx (+2 -2)
📝 packages/loot-core/src/client/state-types/modals.d.ts (+2 -2)
📝 packages/loot-core/src/server/api.ts (+37 -0)
📝 packages/loot-core/src/server/errors.ts (+3 -2)
📝 packages/loot-core/src/server/rules/app.ts (+2 -2)
📝 packages/loot-core/src/types/api-handlers.d.ts (+12 -2)
📝 packages/loot-core/src/types/models/rule.d.ts (+5 -2)
📝 packages/loot-core/src/types/server-handlers.d.ts (+2 -1)
upcoming-release-notes/2568.md (+6 -0)

📄 Description

This adds the following API endpoints for working with payee rules:

  • getPayeeRules()
  • createPayeeRule(rule)
  • updatePayeeRule(id, rule)
  • deletePayeeRule(id)

Note that deletePayeeRule accepts either the rule ID or a rule object (that has an id property). So you can pass in things returned from getPayeeRules() there.

updatePayeeRule will ignore the id property on the rule, favoring the one passed in as first argument.


🔄 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/2568 **Author:** [@psybers](https://github.com/psybers) **Created:** 4/8/2024 **Status:** ✅ Merged **Merged:** 5/14/2024 **Merged by:** [@youngcw](https://github.com/youngcw) **Base:** `master` ← **Head:** `rules-api` --- ### 📝 Commits (10+) - [`3d15ae3`](https://github.com/actualbudget/actual/commit/3d15ae3cf465349a7316d7cf4a5c920f1f9166d6) Add API for working with rules - [`59f6092`](https://github.com/actualbudget/actual/commit/59f60929007795e1539c59b5bba66569de09f10d) Add release note - [`945bb71`](https://github.com/actualbudget/actual/commit/945bb713f518ef539389dcb5a766e035febfe460) Change 'payees-get-rules' return type to RuleEntity[] - [`fe4c3d4`](https://github.com/actualbudget/actual/commit/fe4c3d40cf2365d1fd389346cf2fdb791cca8a30) Reuse existing handlers, make names not have 'payee', add two getters - [`409ff1d`](https://github.com/actualbudget/actual/commit/409ff1dca71a2f8bd6907626011c73fe529537d3) fix linter - [`2daa387`](https://github.com/actualbudget/actual/commit/2daa387f0e01fcac4fe0d920c50f396e4743fcaa) fix bad handler name - [`ed1e0ab`](https://github.com/actualbudget/actual/commit/ed1e0abed8093b257791127aa4ca930032d2baaf) fix broken handler name - [`1196a8b`](https://github.com/actualbudget/actual/commit/1196a8bde273defb7e40564ccb9f64d74af224f7) add test cases for 'getPayeeRules' - [`5b3f099`](https://github.com/actualbudget/actual/commit/5b3f09978f3859fe58ae34a6f70bbb30c49f0d68) fix broken test - [`5bc4df9`](https://github.com/actualbudget/actual/commit/5bc4df94bbdca598c821c2b7773ef5f17f54a4de) Remove unused locals ### 📊 Changes **11 files changed** (+299 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `packages/api/methods.test.ts` (+208 -0) 📝 `packages/api/methods.ts` (+20 -0) 📝 `packages/desktop-client/src/components/ManageRules.tsx` (+2 -2) 📝 `packages/loot-core/src/client/state-types/modals.d.ts` (+2 -2) 📝 `packages/loot-core/src/server/api.ts` (+37 -0) 📝 `packages/loot-core/src/server/errors.ts` (+3 -2) 📝 `packages/loot-core/src/server/rules/app.ts` (+2 -2) 📝 `packages/loot-core/src/types/api-handlers.d.ts` (+12 -2) 📝 `packages/loot-core/src/types/models/rule.d.ts` (+5 -2) 📝 `packages/loot-core/src/types/server-handlers.d.ts` (+2 -1) ➕ `upcoming-release-notes/2568.md` (+6 -0) </details> ### 📄 Description This adds the following API endpoints for working with payee rules: - getPayeeRules() - createPayeeRule(rule) - updatePayeeRule(id, rule) - deletePayeeRule(id) Note that `deletePayeeRule` accepts either the rule ID *or* a rule object (that has an `id` property). So you can pass in things returned from `getPayeeRules()` there. `updatePayeeRule` will ignore the `id` property on the rule, favoring the one passed in as first argument. --- <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-04-14 20:50:53 -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#18736