Open mstrYoda opened 5 years ago
In that example what I tried to do is separate Commands from Queries, that is the reason why the Controller is accessing directly the repository for the queries. That way the application services are only about use cases (actions). Yes, I could make the UI not use the repository directly and access Projections or Queries.
The way I understand it API is not that different from the infrastructure, they are both external layers, inside the hexagon there are only 2 layers the uses cases and in the core the domain layer.
I've saw that you directly reference infrastructure layer into api. Is not that there should be an abstraction between them? Like a ports&adapters or use case driven implementation which explained here :
https://herbertograca.com/2017/11/16/explicit-architecture-01-ddd-hexagonal-onion-clean-cqrs-how-i-put-it-all-together/ https://herbertograca.com/2017/09/14/ports-adapters-architecture/
You already have an application layer which takes commands and process them via accessing infrastructure and domain. I think that it will be more accurate to abstract api from infra.
If you have any information like blog posts about "making api layer dependent on infrastructure is not a mistake & is acceptable", can you share it to me?