Skip to content
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

feat(backend): get user by id #68

Merged
merged 7 commits into from
Sep 10, 2021
Merged

feat(backend): get user by id #68

merged 7 commits into from
Sep 10, 2021

Conversation

Sanix-Darker
Copy link
Member

Why ?
We need to get an user by it's ID

How ?

  • Added a Handler and the route for this endpoint
  • Added a function to get that user with db object

Steps to verify:
Just by running : curl http://127.0.0.1:9999/api/user/:userID after creating a user, the userID is the ID of that user !

Screenshots (optional):

Peek 2021-09-10 11-33

@@ -39,4 +39,5 @@ func AuthRouter() {

router.GET("/auth", authHandler(*oauthConf))
router.POST("/auth", githubCallbackHandler(*oauthConf))
router.GET("/user/:userID", getUserByIdHandler)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
router.GET("/user/:userID", getUserByIdHandler)
router.GET("/users/:userID", getUserByIdHandler)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the docs

@@ -55,6 +84,7 @@ func githubCallbackHandler(oauthConf oauth2.Config) gin.HandlerFunc {
return gin.HandlerFunc(fn)
}

// authHandler will return the url to the clien with the githubClientID for him to logIN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// authHandler will return the url to the clien with the githubClientID for him to logIN
// authHandler will return the url to the client with the githubClientID for him to logIN

@DipandaAser
Copy link
Member

LGTM. Thanks @Sanix-Darker

@Sanix-Darker Sanix-Darker merged commit 511d504 into main Sep 10, 2021
@Sanix-Darker Sanix-Darker deleted the feat/get-user-by-id branch September 21, 2021 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend need review Need some reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants