Skip to content

Conversation

@spokonya
Copy link

@spokonya spokonya commented Jan 16, 2026

Stuff added:

  • GET endpoint for users by ID
  • handler + tests
  • repository for users
  • user model

Closes #45


}

func NewUserHandler(repo UsersRepository) *UsersHandler {
Copy link
Contributor

Choose a reason for hiding this comment

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

NewUsersHandler

Copy link
Author

Choose a reason for hiding this comment

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

done


return devs, nil
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this? Or mv it to a separate pr? It's not related to get users

Copy link
Author

Choose a reason for hiding this comment

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

mb this was totally from the bootcamp exercise and I never got rid of it

Copy link
Author

@spokonya spokonya left a comment

Choose a reason for hiding this comment

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

Addressed comments:

  • removed devs stuff
  • Made NewUsersHandler plural
  • Fixed naming convention for searching for a user at the db/repository level with "Find" instead of "Get"

type UsersRepository interface {

GetUserById(ctx context.Context, id string) (*models.User, error)
FindUserById(ctx context.Context, id string) (*models.User, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

For naming conventions, it's implied that FindT is FindTByid. One of the gotchas in naming that I forgot to mention, if its named findUser, it's implied that the param is the primary key/id unless otherwise stated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/GET users/id

3 participants