0

I am building a REST Api from scratch so i am overthinking and revisiting various approaches and best practices.

I have a Materials repository that serve all the sub-domains of our logic.

Also i have a Sales and Inventory sub domains that both relate to the Materials.

I found this question that evolves exactly around what i am doing and after going and now another question arises for me in regards to Repository pattern.

Let's consider the following REST Api routes:

  1. /masterdata/materials. Provide a list of materials and their master data.
  2. /sales/materials. Provide Sales per material in different granularoty.

Where the methods that satisfy /sales/materials have to be implemented?

In the Repository of Materials or in the Sales repository?

2
  • 1
    The Url /sales/materials implies that your aggregate is "sales," so that's where I would start. But at the end of the day it doesn't really matter where you retrieve the materials from, since there's no all-seeing, all-knowing authority looking over your shoulder telling you whether you're doing it right or wrong. Put the materials retrieval method where it makes the most sense to you. Commented May 18, 2021 at 13:57
  • 1
    If it were up to me, I'd probably have the Sales repository call the Materials repository to retrieve materials, but the method will still work no matter where you put it. Commented May 18, 2021 at 13:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.