From e64a8d82977b9ef22af44d9bb18fb39cbfd1591a Mon Sep 17 00:00:00 2001 From: parseyong Date: Wed, 17 Jul 2024 15:17:24 +0900 Subject: [PATCH] =?UTF-8?q?[Refactor]=20=ED=8C=94=EB=A1=9C=EC=9A=B0?= =?UTF-8?q?=EC=97=AC=EB=B6=80=EB=A5=BC=20=EC=B2=B4=ED=81=AC=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=A9=94=EC=86=8C=EB=93=9C=EC=9D=98=20=EC=A0=91?= =?UTF-8?q?=EA=B7=BC=EC=A0=9C=EC=96=B4=EC=9E=90=EB=A5=BC=20public=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD#107?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/me/snaptime/friend/service/FriendService.java | 5 +++++ .../me/snaptime/friend/service/impl/FriendServiceImpl.java | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/snaptime/friend/service/FriendService.java b/src/main/java/me/snaptime/friend/service/FriendService.java index 56a36beb..b3b89c54 100644 --- a/src/main/java/me/snaptime/friend/service/FriendService.java +++ b/src/main/java/me/snaptime/friend/service/FriendService.java @@ -25,5 +25,10 @@ FindFriendResDto findFriendList(String loginId, String targetLoginId, Long pageN // 유저 프로필 조회 시 팔로잉,팔로워 수를 반환하는 메소드 FriendCntResDto findFriendCnt(String loginId); + /* + reqUser가 targetUser를 팔로우했는 지 여부 반환 + */ + boolean checkIsFollow(User reqUser, User targetUser); + } diff --git a/src/main/java/me/snaptime/friend/service/impl/FriendServiceImpl.java b/src/main/java/me/snaptime/friend/service/impl/FriendServiceImpl.java index 4e44fea6..fce0c3be 100644 --- a/src/main/java/me/snaptime/friend/service/impl/FriendServiceImpl.java +++ b/src/main/java/me/snaptime/friend/service/impl/FriendServiceImpl.java @@ -110,7 +110,7 @@ public FindFriendResDto findFriendList(String reqLoginId, String targetLoginId, List friendInfoList = result.stream().map(entity -> { - boolean isMyFriend = checkIsFriend(reqUser ,findUserByLoginId(entity.get(user.loginId))); + boolean isMyFriend = checkIsFollow(reqUser ,findUserByLoginId(entity.get(user.loginId))); String profilePhotoURL = urlComponent.makeProfileURL(entity.get(user.profilePhoto.id)); return FriendInfo.toDto(entity,profilePhotoURL,isMyFriend); }).collect(Collectors.toList()); @@ -130,8 +130,8 @@ public FriendCntResDto findFriendCnt(String loginId){ return FriendCntResDto.toDto(followerCnt,followingCnt); } - // 자신이 해당유저를 팔로우했는 지 유무 반환 - private boolean checkIsFriend(User reqUser, User targetUser){ + @Override + public boolean checkIsFollow(User reqUser, User targetUser){ return friendRepository.existsBySenderAndReceiver(reqUser, targetUser); }