Conversation
Introduce user profile endpoints and related service/DTO/entity changes. Adds UserController (/api/user/me) with GET, PUT and password update endpoints guarded by roles; new request DTOs UpdateUserRequest and ChangePasswordRequest with validation. Introduce BaseEntity (UUID id, createdAt, updatedAt, isDeleted) and update User to extend it; apply SQL restriction to exclude soft-deleted users and update mapper to ignore isDeleted. Add UserService implementing getProfile, updateProfile (checks for username/email conflicts, persists changes and returns refreshed JWT) and changePassword (validates current password). Add UserNotFoundException and register handler in GlobalExceptionHandler. Add Flyway migration V2 to add is_deleted column to users table.
Introduce comprehensive JUnit tests for user controller and service layers. Adds UserControllerTest (MockMvc tests covering getProfile, updateProfile and changePassword with success and error cases, including exception handling via GlobalExceptionHandler) and UserServiceTest (unit tests for getProfile, updateProfile and changePassword covering success paths, validation, and exceptions like UserAlreadyExistsException, InvalidCredentialsException, and UserNotFoundException). Tests use Mockito to mock dependencies and verify behavior and side effects.
… returns 400 instead of 401
3ee389c to
f591854
Compare
Introduce user profile endpoints and related service/DTO/entity changes. Adds UserController (/api/user/me) with GET, PUT and password update endpoints guarded by roles; new request DTOs UpdateUserRequest and ChangePasswordRequest with validation. Introduce BaseEntity (UUID id, createdAt, updatedAt, isDeleted) and update User to extend it; apply SQL restriction to exclude soft-deleted users and update mapper to ignore isDeleted. Add UserService implementing getProfile, updateProfile (checks for username/email conflicts, persists changes and returns refreshed JWT) and changePassword (validates current password). Add UserNotFoundException and register handler in GlobalExceptionHandler. Add Flyway migration V2 to add is_deleted column to users table.
Introduce comprehensive JUnit tests for user controller and service layers. Adds UserControllerTest (MockMvc tests covering getProfile, updateProfile and changePassword with success and error cases, including exception handling via GlobalExceptionHandler) and UserServiceTest (unit tests for getProfile, updateProfile and changePassword covering success paths, validation, and exceptions like UserAlreadyExistsException, InvalidCredentialsException, and UserNotFoundException). Tests use Mockito to mock dependencies and verify behavior and side effects.
… returns 400 instead of 401
…AmigosCoding/devoops-user-service into feature/account-management
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Created account management endpoints in User Controller/Service.
Modified User to extend BaseEntity class.
Added Unit tests for related features.