jermainedilao
08/26/2019, 2:24 AMProduct item. Now, that Product must contain category and subcategory. Currently, the API only returns the guid of the category and subcategory.
Now the question is. Should the mapping of getting the category and subcategory from the API and putting them inside the Product class be inside the data module? OR I can put it inside my GetProductUseCase?
If I choose the latter. So my usecase would look something like this:
getProducts()
.zip(repo.getCategory(), repo.getSubCategory())
.flatMap {
product.category = category
product.subcategory = subcategory
}
What’s the best practice for this?Eric Martori
08/26/2019, 11:25 AMguids is an implementation detail of the API and should be dealt by the ProductRepository implementation that deals with it. If in the future the API changes and starts returning nested elements your use case should remain the same and only de repository should changejermainedilao
08/27/2019, 12:32 AM