nazrinharris / pecunia

Massively ambitious personal finance app.
1 stars 0 forks source link

Add a `UserType` to `PecuniaUser` #154

Closed nazrinharris closed 8 months ago

nazrinharris commented 8 months ago

Specifically, I'd like to clearly differentiate local and remote accounts. Not sure if this is the best way forward but it seems like the only way I could think of right now.

Here are some of the pros:

  1. Easy classification of remote and local accounts, which can make it easier to choose how to store user data, if the need ever arises.
  2. I can show if its a local or remote account in LoginScreen

Now, how would I go about doing this? I could of course simply add the field and call it a day, but I have users (namely me) which already have an account and can't just "restart". Thus, I'll need a migration strategy.

Where should this migration method run? I'd presume doing it in EntryScreen would be sufficient.

Maybe have an AuthMigrationRepo where all the related migration method could live. Since I might need to update both local and remote database, this seems like a good choice. Of course, I could just add it in AuthRepo, but AuthRepo already have enough responsibilities.

So decided to add the maybeMigratePecuniaUser in AuthRepo, makes things simpler.

nazrinharris commented 8 months ago

Should be completed with 23139c9 in #132