Skip to content

Commit

Permalink
Merge branch 'develop' into whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Voloshkevych committed Dec 10, 2023
2 parents 36661b6 + a181b06 commit 94ea405
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public ResponseEntity<UserDTO> getCurrentUser(@AuthenticationPrincipal UserPrinc
if (userPrincipal == null) {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
}
UserDTO userDTO = userService.findExpertById(userPrincipal.getId());
UserDTO userDTO = userService.findExpertByUserId(userPrincipal.getId());
return ResponseEntity
.status((userDTO != null) ? HttpStatus.OK : HttpStatus.NOT_FOUND)
.body(userDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public interface UserService {

UserDTO findExpertById(Integer userId);

UserDTO findExpertByUserId(Integer userId);

Page<UserDTO> findAllExperts(UserSearchCriteria userSearchCriteria, Pageable pageable);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ public UserDTO findExpertById(Integer userId) {

}

@Override
public UserDTO findExpertByUserId(Integer userId) {
return userMapper.toUserDTO(userRepository.findById(userId).orElseThrow(
() -> new EntityNotFoundException("User not found")));
}

/**
* Gets doctors by search criteria. For example, if directions, regions and user name fields are empty, the
* findDoctorsProfiles method without parameters is called
Expand Down

0 comments on commit 94ea405

Please sign in to comment.