Account namespace updates: part 2 (categories) #894

Merged
zachgoll merged 1 commits from zachgoll/account-namespace-updates-part-2 into main 2024-06-20 20:15:09 +08:00
zachgoll commented 2024-06-20 20:07:15 +08:00 (Migrated from github.com)

See #892 for a detailed proposal of these changes. I will be opening several PRs to achieve the final state so there is a semi-readable history of the changes.

Part 2 renames Transaction::Category to Category and moves all of the routes, controllers, etc. to the top-level namespace.

This thins out the hierarchy and will make it much easier to deal with categories in the final stage of this namespace update when we start implementing various types of transactions (some of which may not be valid with a category).

Future considerations for Category

While a Category generally applies to a Transaction (hence why it was originally namespaced), we have had several feature requests asking to be able to apply categories to the Account.

By moving to the top-level namespace, we'll be able to use STI (instead of namespacing—lots of duplication) to model out different types of categories:

class Category < ActiveRecord::Base; end
class TransactionCategory < Category; end
class AccountCategory < Category; end

From a field-level perspective, a TransactionCategory and AccountCategory has nearly the same exact attributes (i.e. name, color), making it a good candidate for this type of inheritance. We can then use the type to help delineate the management of these family-defined categories in the UI.

See #892 for a detailed proposal of these changes. I will be opening several PRs to achieve the final state so there is a semi-readable history of the changes. Part 2 renames `Transaction::Category` to `Category` and moves all of the routes, controllers, etc. to the top-level namespace. This thins out the hierarchy and will make it much easier to deal with categories in the final stage of this namespace update when we start implementing various types of transactions (some of which may not be valid with a category). ## Future considerations for `Category` While a `Category` generally applies to a `Transaction` (hence why it was originally namespaced), we have had several feature requests asking to be able to apply categories to the `Account`. By moving to the top-level namespace, we'll be able to use STI (instead of namespacing—lots of duplication) to model out different types of categories: ``` class Category < ActiveRecord::Base; end class TransactionCategory < Category; end class AccountCategory < Category; end ``` From a field-level perspective, a `TransactionCategory` and `AccountCategory` has nearly the same exact attributes (i.e. `name`, `color`), making it a good candidate for this type of inheritance. We can then use the `type` to help delineate the management of these family-defined categories in the UI.
Sign in to join this conversation.