Skip to content

Commit

Permalink
[Merge] main <- seyong#107-refactor-friend-method
Browse files Browse the repository at this point in the history
[Refactor] checkIsFollow메소드의 접근제어자를 public로 변경
  • Loading branch information
parseyong authored Jul 17, 2024
2 parents ad13a08 + e64a8d8 commit 78b1d61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/main/java/me/snaptime/friend/service/FriendService.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ FindFriendResDto findFriendList(String loginId, String targetLoginId, Long pageN
// 유저 프로필 조회 시 팔로잉,팔로워 수를 반환하는 메소드
FriendCntResDto findFriendCnt(String loginId);

/*
reqUser가 targetUser를 팔로우했는 지 여부 반환
*/
boolean checkIsFollow(User reqUser, User targetUser);


}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public FindFriendResDto findFriendList(String reqLoginId, String targetLoginId,

List<FriendInfo> 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());
Expand All @@ -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);
}

Expand Down

0 comments on commit 78b1d61

Please sign in to comment.