Skip to content

Commit

Permalink
Merge pull request #859 from bounswe/main
Browse files Browse the repository at this point in the history
Deploy recent changes 26.11.2023 16.43
  • Loading branch information
halisbal authored Nov 26, 2023
2 parents 3a1a952 + 4bd6753 commit f0eadb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public ResponseEntity<List<GetLastActivitiesResponseDto>> getReviews(@RequestHea
}

@PostMapping("/get")
public ResponseEntity<ProfilePageResponseDto> getProfile(@RequestParam String id, @RequestHeader(name = HttpHeaders.AUTHORIZATION, required = false) String Authorization) {
public ResponseEntity<ProfilePageResponseDto> getProfile(@RequestParam String userId, @RequestHeader(name = HttpHeaders.AUTHORIZATION, required = false) String Authorization) {
String email;
if (JwtUtil.validateToken(Authorization)) email = JwtUtil.extractSubject(Authorization);
else email = "";

ProfilePageResponseDto profile = profileService.getProfile(id, email);
ProfilePageResponseDto profile = profileService.getProfile(userId, email);
return ResponseEntity.ok(profile);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ public Profile removeGameFromProfile(String id, ProfileUpdateGameRequestDto requ
return profileRepository.save(editedProfile);
}

public ProfilePageResponseDto getProfile(String id, String email) {
Optional<Profile> optionalProfile = profileRepository.findById(id);
public ProfilePageResponseDto getProfile(String userId, String email) {
Optional<Profile> optionalProfile = profileRepository.findByUserIdAndIsDeletedFalse(userId);

if (optionalProfile.isEmpty() || optionalProfile.get().getIsDeleted()) {
throw new ResourceNotFoundException("The profile with the given id is not found.");
throw new ResourceNotFoundException("The profile for the given user id is not found.");
}

Profile profile = optionalProfile.get();
Expand Down

0 comments on commit f0eadb8

Please sign in to comment.