3 ms·
I prefer controllers to have only one service. A controller should do as little as possible. Its responsibility is just to pass data from the request to the ser
by qw 10y ago
I prefer controllers to have only one service. A controller should do as little as possible. Its responsibility is just to pass data from the request to the service.
The same should apply to repositories unless it is absolutely necessary. It should ideally just know enough to manage itself
A service may reference other services if it needs to coordinate actions. We need to be careful not to make huge services that contains too much logic though
I have found that this pattern makes it not only easier to structure the application, but also much easier to make mocked tests.