-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
Declouple Controller from MongoDB #8
Comments
Your point is valid. A few more developers also suggested making this change. I shall do it. Thanks |
I understood your suggestion but makes me wonder how can we properly handle errors like this to not be generic InternalServerError? Sorry for the late response here, I just found this project |
I would recommend moving this code to the MongoDB repository and also suggest creating a custom error in the following manner: task, err := primitive.ObjectIDFromHex(userID)
if err != nil {
return nil, ErrMyCustonIDGeneration("error message") // change the error name ;)
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
We have a MongoDB dependency in the controller. You can see here: https://github.com/amitshekhariitbhu/go-backend-clean-architecture/blob/main/api/controller/task_controller.go#L8
Maybe we should consider move the code bellow to other layer:
What's your thoughts?
The text was updated successfully, but these errors were encountered: