-
Notifications
You must be signed in to change notification settings - Fork 11
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
Bug fixes after 634 #623
Bug fixes after 634 #623
Conversation
First pull request to Master
Deployment changes
Merge release to master
Merge from release into master
Merge release to master
Merge release to master
Merge release into master
Merge release into master
Merge Release into Master
Merge Release into Master
Merge develop into release
Merge develop into release
refresh_token_logic
fields for user, response statuses
coockie settings
cookie domain
added new endpoints
refresh token test
Formatting "publishAt"
merging develop to release
merging develop to release
merging develop to release
logging: develop -> release
merge develop -> realese
develop -> release, log refactor
Merge develop to release
* Implement user account activation logic without tests, they will be in next commits * Return port 5432 to docker compose file * Made changes regarding comments * Made changes regarding comments * Delete rewrite (#616) * Refactored deleteById method * Fixed style errors * Tests are ready to go * Refactored deleteById method * Fixed style errors * Tests are ready to go * Added eventPublisher for deleteById method * Added method to change status * Change user methods to work with authorId (#617) * Change everywhere we use userId to AuthorId and then add logic to get userEntity from authorEntity, change some dtos * Change tests to new version of code * Change tests to new version of code * Change tests to new version of code * test * test * test * Delete rewrite (#616) * Refactored deleteById method * Fixed style errors * Tests are ready to go * Refactored deleteById method * Fixed style errors * Tests are ready to go * Added eventPublisher for deleteById method * Added method to change status * Change everywhere we use userId to AuthorId and then add logic to get userEntity from authorEntity, change some dtos * Change tests to new version of code * Change tests to new version of code * Change tests to new version of code * test * test * test * Add join author id to all queries that returns user information --------- Co-authored-by: VadimasikKPI <fhghvhg314@gmail.com> Co-authored-by: Voloshkevych <59647995+Voloshkevych@users.noreply.github.com> --------- Co-authored-by: VadimasikKPI <fhghvhg314@gmail.com> Co-authored-by: Voloshkevych <59647995+Voloshkevych@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there!
Overall looks good. Dropped a few comments on some improvements. Please check if it's feasible to implement.
Thanks)
+ "U.phone, U.created_at, U.avatar,U.enabled,U.role_id, U.edited_at, " | ||
+ "U.public_email, D.author_id as \"user_id\" from USERS U\n" | ||
+ "JOIN AUTHORS D ON U.user_id=D.user_id") | ||
value = "SELECT U.* from USERS U\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value = "SELECT U.* from USERS U\n") | |
value = "SELECT U.* from USERS U") |
@@ -97,7 +97,11 @@ public Page<UserEntity> findAll(Pageable pageable) { | |||
*/ | |||
@Override | |||
public UserDTO findExpertById(Integer userId) { | |||
return userMapper.toUserDTO(userRepository.findById(userId).orElse(null)); | |||
AuthorEntity author = authorRepository.findById(userId).orElse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AuthorEntity author = authorRepository.findById(userId).orElse(null); | |
AuthorEntity author = authorRepository.findById(userId).orElseThrow(() -> new EntityNotFoundException("Author not found"));; |
And you can remove if-statement.
This is a more concise way to achieve the same outcome.
if (author == null) { | ||
throw new EntityNotFoundException("Author not found"); | ||
} | ||
return userMapper.toUserDTO(userRepository.findById(author.getProfile().getId()).orElse(null)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a good practice to return null value. Try to avoid such cases if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it good to also throw EntityNotFoundException in this case like in previous one to avoid null returning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's definitely better than returning null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! :)
develop
GitHub Board
Issue link
#11 Issue name
Story link
#11 Story
Code reviewers
Summary of issue
Summary of change