diff --git a/src/main/java/com/umc/TheGoods/converter/member/MemberConverter.java b/src/main/java/com/umc/TheGoods/converter/member/MemberConverter.java index c9ac4bb..a5d0a03 100644 --- a/src/main/java/com/umc/TheGoods/converter/member/MemberConverter.java +++ b/src/main/java/com/umc/TheGoods/converter/member/MemberConverter.java @@ -234,7 +234,8 @@ public static ProfileImg toProfileImg(String url, Member member) { .build(); } - public static MemberResponseDTO.ProfileResultDTO toProfile(Member member, String url, List account, List
address) { + public static MemberResponseDTO.ProfileResultDTO toProfile(Member member, String url, List account, + List
address, Long following, Long dibs) { List accountList = account.stream().map(a -> MemberResponseDTO.AccountDTO.builder() .id(a.getId()) @@ -261,6 +262,8 @@ public static MemberResponseDTO.ProfileResultDTO toProfile(Member member, String .url(url) .accountList(null) .addressList(null) + .following(following) + .dibs(dibs) .build(); } if (account.isEmpty()){ @@ -270,6 +273,8 @@ public static MemberResponseDTO.ProfileResultDTO toProfile(Member member, String .url(url) .addressList(addressList) .accountList(accountList) + .following(following) + .dibs(dibs) .build(); } if(address.isEmpty()){ @@ -279,6 +284,8 @@ public static MemberResponseDTO.ProfileResultDTO toProfile(Member member, String .url(url) .addressList(null) .accountList(accountList) + .following(following) + .dibs(dibs) .build(); } @@ -288,6 +295,8 @@ public static MemberResponseDTO.ProfileResultDTO toProfile(Member member, String .url(url) .addressList(addressList) .accountList(accountList) + .following(following) + .dibs(dibs) .build(); } diff --git a/src/main/java/com/umc/TheGoods/web/controller/MemberController.java b/src/main/java/com/umc/TheGoods/web/controller/MemberController.java index 15c9be5..cdd5d00 100644 --- a/src/main/java/com/umc/TheGoods/web/controller/MemberController.java +++ b/src/main/java/com/umc/TheGoods/web/controller/MemberController.java @@ -233,28 +233,6 @@ public ApiResponse naverCallback(@RequestParam String code, String state) { } - @GetMapping(value = "/profile") - @Operation(summary = "프로필 조회 api", description = "프로필이미지, 닉네임을 조회할 수 있습니다.") - public ApiResponse getProfile(Authentication authentication) { - - - - Member member = memberQueryService.findMemberById(Long.valueOf(authentication.getName().toString())).orElseThrow(() -> new MemberHandler(ErrorStatus.MEMBER_NOT_FOUND)); - Optional profileImg = memberQueryService.findProfileImgByMember(member.getId()); - List
address = memberQueryService.findAllAddressById(member.getId()); - List account = memberQueryService.findAllAccountById(member.getId()); - - - - if(profileImg.isEmpty()){ - return ApiResponse.onSuccess(MemberConverter.toProfile(member, null, account, address)); - } - else { - return ApiResponse.onSuccess(MemberConverter.toProfile(member, profileImg.get().getUrl(),account, address)); - } - - - } diff --git a/src/main/java/com/umc/TheGoods/web/controller/MyPageController.java b/src/main/java/com/umc/TheGoods/web/controller/MyPageController.java index 95aec87..eb10f66 100644 --- a/src/main/java/com/umc/TheGoods/web/controller/MyPageController.java +++ b/src/main/java/com/umc/TheGoods/web/controller/MyPageController.java @@ -6,6 +6,7 @@ import com.umc.TheGoods.apiPayload.exception.handler.MemberHandler; import com.umc.TheGoods.converter.member.MemberConverter; import com.umc.TheGoods.domain.enums.OrderStatus; +import com.umc.TheGoods.domain.images.ProfileImg; import com.umc.TheGoods.domain.item.Category; import com.umc.TheGoods.domain.item.Tag; import com.umc.TheGoods.domain.member.Auth; @@ -292,6 +293,30 @@ public ApiResponse postContact(Authentication authentication, return ApiResponse.of(SuccessStatus.MEMBER_CONTACT_SUCCESS,null); } + @GetMapping(value = "/profile") + @Operation(summary = "프로필 조회 api", description = "프로필이미지, 닉네임, 주소, 계좌, 팔로잉 수, 찜 수를 조회할 수 있습니다.") + public ApiResponse getProfile(Authentication authentication) { + + + + Member member = memberQueryService.findMemberById(Long.valueOf(authentication.getName().toString())).orElseThrow(() -> new MemberHandler(ErrorStatus.MEMBER_NOT_FOUND)); + Optional profileImg = memberQueryService.findProfileImgByMember(member.getId()); + List
address = memberQueryService.findAllAddressById(member.getId()); + List account = memberQueryService.findAllAccountById(member.getId()); + Long following = Long.valueOf(member.getFollowingList().size()); + Long dibs = Long.valueOf(member.getDibsList().size()); + + + + if(profileImg.isEmpty()){ + return ApiResponse.onSuccess(MemberConverter.toProfile(member, null, account, address,following,dibs)); + } + else { + return ApiResponse.onSuccess(MemberConverter.toProfile(member, profileImg.get().getUrl(),account, address,following,dibs)); + } + + + } /** * 주문 상세 내역 * 입금처, 입금 은행, 상품 사진, 상품 이름, 상품 옵션, 주문 상태(결제 전, 결제 완료), 주문자명, 주문자 연락처, 주문 번호, 상품 주문 개수, 상품가격 diff --git a/src/main/java/com/umc/TheGoods/web/dto/member/MemberResponseDTO.java b/src/main/java/com/umc/TheGoods/web/dto/member/MemberResponseDTO.java index 20688ea..cfa981c 100644 --- a/src/main/java/com/umc/TheGoods/web/dto/member/MemberResponseDTO.java +++ b/src/main/java/com/umc/TheGoods/web/dto/member/MemberResponseDTO.java @@ -166,6 +166,8 @@ public static class ProfileResultDTO { String phone; List addressList; List accountList; + Long following; + Long dibs; }