Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimasikKPI committed Nov 20, 2023
1 parent 4583169 commit 14babae
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 @@ -153,7 +153,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 @@ -23,6 +23,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 @@ -104,6 +104,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 14babae

Please sign in to comment.