-
-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion about use cases #10
Comments
Just bringing up a point for discussion. I've noticed that the use cases have multiple responsibilities, as seen in the case of LoginUsecase. This use case encompasses various functions: GetUserByEmail, CreateAccessToken, CreateRefreshToken... From my perspective, Login itself should already be a use case. loginUsecase = usecase.NewLoginUsecase()
loginUsecase.execute() Whats your thoughts? |
Will it be a good idea to implement all the repository related functions in usecase and use the controller only for sanitising the input from the route, calling the use case and then returning the response? |
Hello! Thank you for this repo, it is really helpful. 🎉
I want to ask you about the responsibilities of use cases and controller. If I understood correctly, the controller should have the responsibility of sanitising the input from the route, calling the use case and then returning the response. The use case is the one that contains the business logic.
However, the login use case, is just a wrapper around
UserRepository
and the actual business logic happens in theLoginController
:Here, the controller decides that first we should fetch the user, then we check if the password is correct and if it is, we generate both an access token and a refresh token. This is the business logic of a login and I feel like it should be in the use case.
The text was updated successfully, but these errors were encountered: