feat(get_user_by_id): Add endpoint get user by id in database#25
Conversation
There was a problem hiding this comment.
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
GetUserByIdUseCaseandUpdateRandomUserUseCase, plusUserNotFoundException. - Extend
UserService/UserServiceImplwithgetByIdandsave, and wire new endpoints inUserController/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.
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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.
|
There was a problem hiding this comment.
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.
Theo-lbg
left a comment
There was a problem hiding this comment.
LGTM
Just in the future we very need simplify the readme documentation because it's very slow to read ;)




#8