Refactor: separate repo for each model
AbdAllahAbdElFattah13 opened this issue · 1 comments
Usually, we have multiple repos in the app, each responsible for a model. So for example:
- AuthRepo
- UserRepo
- RecipeRepo
Same can be done to the local/remote DS, or as well as the DAOs.
The main reason for this is simply better SRP.
Currently in the app, we have only one repo, I think this can refactored.
Now we have the data repo interface is as followes:
interface DataRepositorySource { suspend fun requestRecipes(): Flow<Resource<Recipes>> suspend fun doLogin(loginRequest: LoginRequest): Flow<Resource<LoginResponse>> suspend fun addToFavourite(id: String): Flow<Resource<Boolean>> suspend fun removeFromFavourite(id: String): Flow<Resource<Boolean>> suspend fun isFavourite(id: String): Flow<Resource<Boolean>> }
I think we can easily break down into 3 separate repos:
- AuthRepo
- RecipesRepo
- UserActionsRepo
I'm still thinking about the last two, should we merge them into one or keep them separate, so if anyone with any ideas please let me know.