diff --git a/src/main/java/me/snaptime/profile/service/ProfileService.java b/src/main/java/me/snaptime/profile/service/ProfileService.java index e9bb5905..d0964a7b 100644 --- a/src/main/java/me/snaptime/profile/service/ProfileService.java +++ b/src/main/java/me/snaptime/profile/service/ProfileService.java @@ -17,4 +17,5 @@ public interface ProfileService { /* loginId에 해당하는 User가 Tag된 snap들을 조회합니다 */ List getTagSnap(String email); + } diff --git a/src/main/java/me/snaptime/profile/service/impl/ProfileServiceImpl.java b/src/main/java/me/snaptime/profile/service/impl/ProfileServiceImpl.java index 763dfe0c..53a03a83 100644 --- a/src/main/java/me/snaptime/profile/service/impl/ProfileServiceImpl.java +++ b/src/main/java/me/snaptime/profile/service/impl/ProfileServiceImpl.java @@ -79,4 +79,8 @@ public List getTagSnap(String email) { return profileRepository.findTagSnap(user); } + + + + } diff --git a/src/main/java/me/snaptime/snap/dto/res/SnapDetailInfoResDto.java b/src/main/java/me/snaptime/snap/dto/res/SnapDetailInfoResDto.java index 41e26497..99eb9814 100644 --- a/src/main/java/me/snaptime/snap/dto/res/SnapDetailInfoResDto.java +++ b/src/main/java/me/snaptime/snap/dto/res/SnapDetailInfoResDto.java @@ -26,6 +26,7 @@ public record SnapDetailInfoResDto( List tagUserFindResDtos, Long likeCnt, boolean isLikedSnap + ) { public static SnapDetailInfoResDto toDto(Tuple tuple, String profilePhotoURL, String snapPhotoURL, List tagUserFindResDtos, Long likeCnt, boolean isLikedSnap){ diff --git a/src/main/java/me/snaptime/snap/service/impl/SnapServiceImpl.java b/src/main/java/me/snaptime/snap/service/impl/SnapServiceImpl.java index 44337b87..1fb7b65e 100644 --- a/src/main/java/me/snaptime/snap/service/impl/SnapServiceImpl.java +++ b/src/main/java/me/snaptime/snap/service/impl/SnapServiceImpl.java @@ -85,17 +85,17 @@ public Long createSnap(CreateSnapReqDto createSnapReqDto, String userEmail, bool } @Override - public SnapDetailInfoResDto findSnap(Long id, String userEmail) { - Snap foundSnap = snapRepository.findById(id).orElseThrow(() -> new CustomException(ExceptionCode.SNAP_NOT_EXIST)); - if(foundSnap.isPrivate()) { - User foundUser = userRepository.findByEmail(userEmail).orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST)); - // Snap이 비공개라면, 요청한 유저와 스냅의 ID가 일치하는지 확인한다. - if (!Objects.equals(foundUser.getUserId(), foundSnap.getUser().getUserId())) { - throw new CustomException(ExceptionCode.SNAP_IS_PRIVATE); + public SnapDetailInfoResDto findSnap(Long id, String userEmail) { + Snap foundSnap = snapRepository.findById(id).orElseThrow(() -> new CustomException(ExceptionCode.SNAP_NOT_EXIST)); + if(foundSnap.isPrivate()) { + User foundUser = userRepository.findByEmail(userEmail).orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST)); + // Snap이 비공개라면, 요청한 유저와 스냅의 ID가 일치하는지 확인한다. + if (!Objects.equals(foundUser.getUserId(), foundSnap.getUser().getUserId())) { + throw new CustomException(ExceptionCode.SNAP_IS_PRIVATE); + } } - } - String snapPhotoUrl = urlComponent.makePhotoURL(foundSnap.getFileName(), foundSnap.isPrivate()); - String profilePhotoUrl = urlComponent.makeProfileURL(foundSnap.getUser().getProfilePhoto().getProfilePhotoId()); + String snapPhotoUrl = urlComponent.makePhotoURL(foundSnap.getFileName(), foundSnap.isPrivate()); + String profilePhotoUrl = urlComponent.makeProfileURL(foundSnap.getUser().getProfilePhoto().getProfilePhotoId()); List tagUserFindResDtos = snapTagService.findTagUsers(foundSnap.getId()); Long likeCnt = snapLikeService.findSnapLikeCnt(foundSnap.getId()); boolean isLikedSnap = snapLikeService.isLikedSnap(foundSnap.getId(), userEmail); diff --git a/src/main/resources/test_resource/default.png b/src/main/resources/test_resource/default.png index 738f03d2..b483f1c2 100644 Binary files a/src/main/resources/test_resource/default.png and b/src/main/resources/test_resource/default.png differ