Add backend support for transaction categories #524

Merged
jakubkottnauer merged 5 commits from transaction-categories into main 2024-03-08 02:15:50 +08:00
jakubkottnauer commented 2024-03-07 22:24:03 +08:00 (Migrated from github.com)

This PR adds basic support for transaction categories in the backend, PR for the UI coming up next. As we've agreed on previously:

  • when a family is created, we seed its categories. Doing this allows for localization and user customization of all categories
  • each category has an internal_category that in the future might be used by the rule engine to discern which category represents what
    • the internal_category field is automatically cleared when a user modifies a category's name as it's original purpose cannot be guaranteed anymore

First time I'm working with Ruby or Rails so please don't hesitate to let me know if there's anything odd 😄

This PR adds basic support for transaction categories in the backend, PR for the UI coming up next. As we've agreed on previously: - when a family is created, we seed its categories. Doing this allows for localization and user customization of all categories - each category has an `internal_category` that in the future might be used by the rule engine to discern which category represents what - the `internal_category` field is automatically cleared when a user modifies a category's name as it's original purpose cannot be guaranteed anymore First time I'm working with Ruby or Rails so please don't hesitate to let me know if there's anything odd 😄
jakubkottnauer (Migrated from github.com) reviewed 2024-03-07 22:28:10 +08:00
@@ -13,6 +13,7 @@ class RegistrationsController < ApplicationController
@user.family = family
if @user.save
Transaction::Category.create_default_categories(@user.family)
jakubkottnauer (Migrated from github.com) commented 2024-03-07 22:28:10 +08:00

I have considered moving this into an after_create callback in the Family model but thought it felt strange having the Family model create other model's instances as a side effect, so I made it explicit like this.

I have considered moving this into an `after_create` callback in the Family model but thought it felt strange having the Family model create other model's instances as a side effect, so I made it explicit like this.
zachgoll (Migrated from github.com) reviewed 2024-03-07 23:14:04 +08:00
@@ -13,6 +13,7 @@ class RegistrationsController < ApplicationController
@user.family = family
if @user.save
Transaction::Category.create_default_categories(@user.family)
zachgoll (Migrated from github.com) commented 2024-03-07 23:14:03 +08:00

Yeah I think especially since we're a little unclear about the requirements of these default categories, where you have it here makes sense for now.

Yeah I think especially since we're a little unclear about the requirements of these default categories, where you have it here makes sense for now.
zachgoll (Migrated from github.com) reviewed 2024-03-07 23:18:45 +08:00
zachgoll (Migrated from github.com) commented 2024-03-07 23:18:45 +08:00

I just checked with our designer and found out we won't be using icons for categories. So we can remove this.

Here's what it will look like:

CleanShot 2024-03-07 at 10 18 37

I just checked with our designer and found out we _won't_ be using icons for categories. So we can remove this. Here's what it will look like: ![CleanShot 2024-03-07 at 10 18 37](https://github.com/maybe-finance/maybe/assets/16676157/78d7b1d3-d0d9-4dbb-8ef7-a5d408c0d799)
zachgoll (Migrated from github.com) approved these changes 2024-03-07 23:23:39 +08:00
zachgoll (Migrated from github.com) left a comment

Nice work, changes here make sense to me!

Let me know what UI related changes you'll be making in the next PR so I can provide the relevant designs.

Nice work, changes here make sense to me! Let me know what UI related changes you'll be making in the next PR so I can provide the relevant designs.
zachgoll (Migrated from github.com) commented 2024-03-07 23:22:29 +08:00

Might be useful to default this to something like #6172F3?

(I didn't use gray because that will be used for "Uncategorized")

Might be useful to default this to something like `#6172F3`? (I didn't use gray because that will be used for "Uncategorized")
Sign in to join this conversation.