ash-bergs / pantry-pal

Keep track of your shopping list and pantry stock
0 stars 0 forks source link

Decouple ItemManager methods from populateItems method #44

Open ash-bergs opened 1 month ago

ash-bergs commented 1 month ago
          This work put me over 10 touched files (13) - but I aimed to do a few things:

There are still areas for improvement, like the coupling of populateItems on all the methods. This can be fixed, but will increase changed files even more so I'll quickly do it following this.

_Originally posted by @ash-bergs in https://github.com/ash-bergs/pantry-pal/pull/43#discussion_r1753093059_

ash-bergs commented 1 month ago

We should just call itemManager.populateItems in the places we call the other methods, instead of inside the methods themselves.

ash-bergs commented 1 month ago

As a part of this we can cleanup some methods as well, like add/remove singular items will basically just call the database service. I'm gonna noodle on the pattern for that for a minute, I wonder if I've flown too close to the sun creating the database service lol - but it was a decision made to give us clear division between database/data logic and ui logic.