Skip to content

Commit

Permalink
🎨 내집다방 화면 조회 - 나를 팔로우하는지 여부 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
HyoBN committed Oct 10, 2023
1 parent 279ce9c commit 5b912ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,14 @@ public static MemberResponseDto.FollowerListDto toFollowerListDto(Page<Follow> f
.build();
}

public static MemberResponseDto.MyZipdabangDto toMyZipdabangDto(Member member, boolean checkSelf, boolean isFollowing,MemberResponseDto.MemberPreferCategoryDto memberPreferCategoryDto) {
public static MemberResponseDto.MyZipdabangDto toMyZipdabangDto(Member member, boolean checkSelf, boolean isFollowing, boolean isFollower, MemberResponseDto.MemberPreferCategoryDto memberPreferCategoryDto) {

return MemberResponseDto.MyZipdabangDto.builder()
.memberId(member.getMemberId())
.imageUrl(member.getProfileUrl())
.checkSelf(checkSelf)
.checkFollowing(isFollowing)
.checkFollower(isFollower)
.nickname(member.getNickname())
.caption(member.getCaption())
.memberPreferCategoryDto(memberPreferCategoryDto)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,22 +470,19 @@ public Boolean checkFollowing(Member loginMember, Member targetMember) {
public MemberResponseDto.MyZipdabangDto getMyZipdabang(Member member, Long targetId) {
Member target = memberRepository.findById(targetId).orElseThrow(() -> new MemberException(CommonStatus.MEMBER_NOT_FOUND));
boolean checkSelf = false;
boolean isFollowing = false;
if (member.getMemberId() == target.getMemberId()) {
checkSelf=true;
}
else if(blockedMemberRepository.existsByOwnerAndBlocked(member,target)){
throw new MemberException(CommonStatus.BLOCKED_MEMBER);
}

if (followRepository.existsByFollowerAndFollowee(member, target)) {
isFollowing=true;
}
boolean isFollowing = followRepository.existsByFollowerAndFollowee(member, target);
boolean isFollower = followRepository.existsByFollowerAndFollowee(target, member);

List<Category> categories = findMemberPreferCategories(member);
MemberResponseDto.MemberPreferCategoryDto memberPreferCategoryDto = MemberConverter.toMemberPreferCategoryDto(categories);

return MemberConverter.toMyZipdabangDto(target, checkSelf, isFollowing, memberPreferCategoryDto);
return MemberConverter.toMyZipdabangDto(target, checkSelf, isFollowing, isFollower, memberPreferCategoryDto);

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ public static class MyZipdabangDto{
String imageUrl;
boolean checkSelf;
boolean checkFollowing;
boolean checkFollower;
String nickname;
String caption;
MemberPreferCategoryDto memberPreferCategoryDto;
Expand Down

0 comments on commit 5b912ba

Please sign in to comment.