From ef45618f910178e42e29238aa4f76ce288de9d21 Mon Sep 17 00:00:00 2001 From: HyoBin Yang <50162252+HyoBN@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:41:24 +0900 Subject: [PATCH] =?UTF-8?q?Wkzb=20398=20:art=20=EB=82=B4=EC=A7=91=EB=8B=A4?= =?UTF-8?q?=EB=B0=A9=20=EC=A1=B0=ED=9A=8C=20API=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#180)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :bug: 내가 차단한 유저 조회 쿼리문 수정 * :sparkles: 내가 좋아요 누른 레시피 조회 API * :sparkles: 내가 스크랩한 레시피 조회 API * :art: 내집다방 화면 조회 - 나를 팔로우하는지 여부 추가 --- .../java/zipdabang/server/converter/MemberConverter.java | 3 ++- .../java/zipdabang/server/service/RecipeService.java | 1 + .../server/service/serviceImpl/MemberServiceImpl.java | 9 +++------ .../server/service/serviceImpl/RecipeServiceImpl.java | 1 + .../server/web/controller/RecipeRestController.java | 1 + .../server/web/dto/responseDto/MemberResponseDto.java | 1 + 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/zipdabang/server/converter/MemberConverter.java b/src/main/java/zipdabang/server/converter/MemberConverter.java index b8f1c56..e6f7198 100644 --- a/src/main/java/zipdabang/server/converter/MemberConverter.java +++ b/src/main/java/zipdabang/server/converter/MemberConverter.java @@ -405,13 +405,14 @@ public static MemberResponseDto.FollowerListDto toFollowerListDto(Page 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) diff --git a/src/main/java/zipdabang/server/service/RecipeService.java b/src/main/java/zipdabang/server/service/RecipeService.java index 42b385b..fd36f1b 100644 --- a/src/main/java/zipdabang/server/service/RecipeService.java +++ b/src/main/java/zipdabang/server/service/RecipeService.java @@ -75,6 +75,7 @@ public interface RecipeService { RecipeResponseDto.RecipePageListDto getLikeRecipes(Integer page, Member member); RecipeResponseDto.RecipePageListDto getScrapRecipes(Integer page, Member member); + Page getTempRecipeList(Integer pageIndex, Member member); Recipe update(Long recipeId, RecipeRequestDto.UpdateRecipeDto request, MultipartFile thumbnail, List stepImages, Member member) throws IOException; diff --git a/src/main/java/zipdabang/server/service/serviceImpl/MemberServiceImpl.java b/src/main/java/zipdabang/server/service/serviceImpl/MemberServiceImpl.java index 9e38e72..d934275 100644 --- a/src/main/java/zipdabang/server/service/serviceImpl/MemberServiceImpl.java +++ b/src/main/java/zipdabang/server/service/serviceImpl/MemberServiceImpl.java @@ -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 categories = findMemberPreferCategories(member); MemberResponseDto.MemberPreferCategoryDto memberPreferCategoryDto = MemberConverter.toMemberPreferCategoryDto(categories); - return MemberConverter.toMyZipdabangDto(target, checkSelf, isFollowing, memberPreferCategoryDto); + return MemberConverter.toMyZipdabangDto(target, checkSelf, isFollowing, isFollower, memberPreferCategoryDto); } } diff --git a/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java b/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java index bb81732..39e4339 100644 --- a/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java +++ b/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java @@ -833,4 +833,5 @@ public RecipeResponseDto.RecipePageListDto getScrapRecipes(Integer page, Member Page scrapRecipes = scrapRepository.findRecipeByMember(member, PageRequest.of(page, pageSize, Sort.by(Sort.Direction.DESC, "createdAt"))); return RecipeConverter.toPagingRecipeDtoList(scrapRecipes, member); } + } diff --git a/src/main/java/zipdabang/server/web/controller/RecipeRestController.java b/src/main/java/zipdabang/server/web/controller/RecipeRestController.java index 61618c2..890e528 100644 --- a/src/main/java/zipdabang/server/web/controller/RecipeRestController.java +++ b/src/main/java/zipdabang/server/web/controller/RecipeRestController.java @@ -817,4 +817,5 @@ else if (page < 1) return ResponseDto.of(recipeService.getScrapRecipes(page, member)); } + } diff --git a/src/main/java/zipdabang/server/web/dto/responseDto/MemberResponseDto.java b/src/main/java/zipdabang/server/web/dto/responseDto/MemberResponseDto.java index 8727450..023f23c 100644 --- a/src/main/java/zipdabang/server/web/dto/responseDto/MemberResponseDto.java +++ b/src/main/java/zipdabang/server/web/dto/responseDto/MemberResponseDto.java @@ -278,6 +278,7 @@ public static class MyZipdabangDto{ String imageUrl; boolean checkSelf; boolean checkFollowing; + boolean checkFollower; String nickname; String caption; MemberPreferCategoryDto memberPreferCategoryDto;