Open todesj opened 2 years ago
It's not really about overkill -- overkill is kinda the name of the game around organization. It's about separation. The reason we stopped getting these super-weird bugs is because the database is completely separate from the rest of the backend, which is completely separate from the fronted. Services are meant to help with that: each service gets a chance to init
, and a Database is a special service that can also signIn
. Each HybridDatabase
is a special type of Database that can also manage two other Databases, a local and a cloud. But still, everything's separate. Just like services shouldn't interact with each other, you don't want databases interacting with each other either.
The way it's set up now, the refresh process is its own database that has control over every other database, which you don't really want. It's simpler to modify the definition of a DatabaseService
to also include a function for updating, just like it already has functions for initialization and signing in. That way, each HybridDatabase
can "keep its hands to itself" and only handle its own changes, while the master Database
class can call the updates on each one. In that way it's like how each service has an init
function but the master Services
class goes to each service and calls them one-by-one.
I cleaned up the commits by force-pushing. Some reviews are gone now but now it's good.
OK I know that a service might be overkill here but it is really that bad if I use. a service instead so I don't have to change it?