Skip to content

feat(get_user_by_id): Add endpoint get user by id in database#25

Merged
MayuriXx merged 5 commits into
mainfrom
get_user_id
Mar 5, 2026
Merged

feat(get_user_by_id): Add endpoint get user by id in database#25
MayuriXx merged 5 commits into
mainfrom
get_user_id

Conversation

@MayuriXx
Copy link
Copy Markdown
Collaborator

@MayuriXx MayuriXx commented Mar 4, 2026

#8

@MayuriXx MayuriXx linked an issue Mar 4, 2026 that may be closed by this pull request
Copilot AI review requested due to automatic review settings March 4, 2026 08:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces database-backed user lookup and update capabilities to the existing “random-users” API surface, adding use cases/services to support GET /random-users/{id} and PUT /random-users/{id}.

Changes:

  • Add GetUserByIdUseCase and UpdateRandomUserUseCase, plus UserNotFoundException.
  • Extend UserService/UserServiceImpl with getById and save, and wire new endpoints in UserController/UserHandler.
  • Add unit tests for the new use cases and service implementation; update README to document the PUT endpoint.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/test/resources/application-test.properties.template Makes test Postgres port configurable via template placeholder.
src/test/java/com/xpeho/spring_boot_java_random_user/domain/usecases/UpdateRandomUserUseCaseTest.java Adds unit tests for update-by-id behavior and not-found handling.
src/test/java/com/xpeho/spring_boot_java_random_user/domain/usecases/GetUserByIdUserUseCaseTest.java Adds unit tests for get-by-id behavior and not-found handling.
src/test/java/com/xpeho/spring_boot_java_random_user/data/services/UserServiceImplTest.java Adds unit tests for UserServiceImpl.getById and save.
src/main/java/com/xpeho/spring_boot_java_random_user/presentation/handlers/UserHandler.java Wires the new get/update endpoints to the corresponding use cases.
src/main/java/com/xpeho/spring_boot_java_random_user/presentation/controllers/UserController.java Adds GET /{id} and PUT /{id} controller methods and OpenAPI annotations.
src/main/java/com/xpeho/spring_boot_java_random_user/domain/usecases/UpdateRandomUserUseCase.java Implements update-by-id logic, preserving the existing user id.
src/main/java/com/xpeho/spring_boot_java_random_user/domain/usecases/GetUserByIdUseCase.java Implements retrieval of a user by id with not-found exception.
src/main/java/com/xpeho/spring_boot_java_random_user/domain/services/UserService.java Extends service contract with getById and save.
src/main/java/com/xpeho/spring_boot_java_random_user/domain/exceptions/UserNotFoundException.java Adds a domain exception for not-found cases.
src/main/java/com/xpeho/spring_boot_java_random_user/data/services/UserServiceImpl.java Implements the new getById and save service methods.
README.md Documents the PUT endpoint and updates the roadmap checkbox for PUT.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment thread README.md Outdated
Copilot AI review requested due to automatic review settings March 4, 2026 09:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 4, 2026

@MayuriXx I've opened a new pull request, #29, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI review requested due to automatic review settings March 4, 2026 10:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 4, 2026 11:21
@sonarqube-xpeho
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Copy link
Copy Markdown
Collaborator

@Theo-lbg Theo-lbg left a comment

Choose a reason for hiding this comment

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

LGTM
Just in the future we very need simplify the readme documentation because it's very slow to read ;)

@MayuriXx MayuriXx merged commit 64df086 into main Mar 5, 2026
11 checks passed
@MayuriXx MayuriXx deleted the get_user_id branch March 5, 2026 09:03
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.

Add this endpoint get /user/{id}

6 participants