blob: 08e978276671f7662b8aa9aca1031c8c18c98cd3 (
plain)
1
2
3
|
The idea of the service layer is that it handles most orchestration concerns for a use case of the application such as wiring together repositories and fetching required domain models. Basically it sets everything up so that we have everything needed to have the domain do its work properly and then persist the changes.
This takes away this kind of logic from the entrypoints like API controllers making those easier to test as they only be concerned with doing web stuff, e.g fetching the data from the request and making sure we form a correct response. That allows us to just run an end to end test for the happy an all unhappy paths on the controller, the rest of the application functionality is covered by the service layer.
|