Skip to content

Commit

Permalink
Wkzb 398 :art 내집다방 조회 API 정보 수정 (#180)
Browse files Browse the repository at this point in the history
* 🐛 내가 차단한 유저 조회 쿼리문 수정

* ✨ 내가 좋아요 누른 레시피 조회 API

* ✨ 내가 스크랩한 레시피 조회 API

* 🎨 내집다방 화면 조회 - 나를 팔로우하는지 여부 추가
  • Loading branch information
HyoBN authored Oct 10, 2023
1 parent 8d74d24 commit ef45618
Show file tree
Hide file tree
Showing 6 changed files with 9 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
1 change: 1 addition & 0 deletions src/main/java/zipdabang/server/service/RecipeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public interface RecipeService {
RecipeResponseDto.RecipePageListDto getLikeRecipes(Integer page, Member member);
RecipeResponseDto.RecipePageListDto getScrapRecipes(Integer page, Member member);


Page<TempRecipe> getTempRecipeList(Integer pageIndex, Member member);

Recipe update(Long recipeId, RecipeRequestDto.UpdateRecipeDto request, MultipartFile thumbnail, List<MultipartFile> stepImages, Member member) throws IOException;
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 @@ -833,4 +833,5 @@ public RecipeResponseDto.RecipePageListDto getScrapRecipes(Integer page, Member
Page<Recipe> scrapRecipes = scrapRepository.findRecipeByMember(member, PageRequest.of(page, pageSize, Sort.by(Sort.Direction.DESC, "createdAt")));
return RecipeConverter.toPagingRecipeDtoList(scrapRecipes, member);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -817,4 +817,5 @@ else if (page < 1)

return ResponseDto.of(recipeService.getScrapRecipes(page, member));
}

}
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 ef45618

Please sign in to comment.