diff --git a/src/main/java/gwangjang/server/domain/subscribe/application/dto/res/SubscribeIssueFeignRes.java b/src/main/java/gwangjang/server/domain/subscribe/application/dto/res/SubscribeIssueFeignRes.java new file mode 100644 index 0000000..cf97124 --- /dev/null +++ b/src/main/java/gwangjang/server/domain/subscribe/application/dto/res/SubscribeIssueFeignRes.java @@ -0,0 +1,23 @@ +package gwangjang.server.domain.subscribe.application.dto.res; + + +import lombok.*; + +@Builder +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class SubscribeIssueFeignRes { + + private String issue; + private Long issueId; + + public SubscribeIssueFeignRes(Long issueId) { + this.issueId = issueId; + } + + public void updateIssue(String issue) { + this.issue = issue; + } +} diff --git a/src/main/java/gwangjang/server/domain/subscribe/application/service/SubscribeContentsUseCase.java b/src/main/java/gwangjang/server/domain/subscribe/application/service/SubscribeContentsUseCase.java index d99678a..0c08281 100644 --- a/src/main/java/gwangjang/server/domain/subscribe/application/service/SubscribeContentsUseCase.java +++ b/src/main/java/gwangjang/server/domain/subscribe/application/service/SubscribeContentsUseCase.java @@ -2,6 +2,7 @@ import gwangjang.server.domain.member.domain.entity.Member; import gwangjang.server.domain.member.domain.service.MemberQueryService; +import gwangjang.server.domain.subscribe.application.dto.res.SubscribeIssueFeignRes; import gwangjang.server.domain.subscribe.application.mapper.SubscribeMapper; import gwangjang.server.domain.subscribe.domain.service.SubscribeQueryService; import jakarta.transaction.Transactional; @@ -20,7 +21,7 @@ public class SubscribeContentsUseCase { private final SubscribeQueryService subscribeQueryService; private final SubscribeMapper subscribeMapper = new SubscribeMapper(); - public List getMySubscribeIssueList(String memberId) { + public List getMySubscribeIssueList(String memberId) { Member member = memberQueryService.getMemberBySocialId(memberId); return subscribeQueryService.getMySubscribeList(member); } diff --git a/src/main/java/gwangjang/server/domain/subscribe/domain/repository/SubscribeCustomRepository.java b/src/main/java/gwangjang/server/domain/subscribe/domain/repository/SubscribeCustomRepository.java index 9da0c28..48d36b0 100644 --- a/src/main/java/gwangjang/server/domain/subscribe/domain/repository/SubscribeCustomRepository.java +++ b/src/main/java/gwangjang/server/domain/subscribe/domain/repository/SubscribeCustomRepository.java @@ -2,6 +2,7 @@ import gwangjang.server.domain.member.domain.entity.Member; import gwangjang.server.domain.subscribe.application.dto.res.IssueBySubscribersRes; +import gwangjang.server.domain.subscribe.application.dto.res.SubscribeIssueFeignRes; import gwangjang.server.domain.subscribe.application.dto.res.SubscribeMemberDto; import gwangjang.server.domain.subscribe.domain.entity.Subscribe; @@ -14,7 +15,7 @@ public interface SubscribeCustomRepository { boolean findCountSubscribeByMember(Member member); List findIssueTop5BySubscribers(); Long findSubscribeCountsByIssue(Long issueId); - List findMySubscribeList(Member member); + List findMySubscribeList(Member member); diff --git a/src/main/java/gwangjang/server/domain/subscribe/domain/repository/SubscribeCustomRepositoryImpl.java b/src/main/java/gwangjang/server/domain/subscribe/domain/repository/SubscribeCustomRepositoryImpl.java index 080727d..3ba3e6d 100644 --- a/src/main/java/gwangjang/server/domain/subscribe/domain/repository/SubscribeCustomRepositoryImpl.java +++ b/src/main/java/gwangjang/server/domain/subscribe/domain/repository/SubscribeCustomRepositoryImpl.java @@ -6,6 +6,7 @@ import gwangjang.server.domain.member.domain.entity.Member; import gwangjang.server.domain.member.domain.entity.QMember; import gwangjang.server.domain.subscribe.application.dto.res.IssueBySubscribersRes; +import gwangjang.server.domain.subscribe.application.dto.res.SubscribeIssueFeignRes; import gwangjang.server.domain.subscribe.application.dto.res.SubscribeMemberDto; import gwangjang.server.domain.subscribe.application.dto.res.SubscribeMyPageRes; import gwangjang.server.domain.subscribe.domain.entity.Subscribe; @@ -85,11 +86,11 @@ public Long findSubscribeCountsByIssue(Long issueId) { .fetchOne(); } - public List findMySubscribeList(Member member) { + public List findMySubscribeList(Member member) { return queryFactory - .select( + .select(Projections.constructor(SubscribeIssueFeignRes.class, subscribe.issueId - ) + )) .from(subscribe) .where(subscribe.member.eq(member)) .fetch(); diff --git a/src/main/java/gwangjang/server/domain/subscribe/domain/service/SubscribeQueryService.java b/src/main/java/gwangjang/server/domain/subscribe/domain/service/SubscribeQueryService.java index 1b62c2e..936e347 100644 --- a/src/main/java/gwangjang/server/domain/subscribe/domain/service/SubscribeQueryService.java +++ b/src/main/java/gwangjang/server/domain/subscribe/domain/service/SubscribeQueryService.java @@ -94,7 +94,17 @@ public List getIssueInfo(List issueIds) { } - public List getMySubscribeList(Member member) { - return subscribeRepository.findMySubscribeList(member); + public List getMySubscribeList(Member member) { + List mySubscribeList = subscribeRepository.findMySubscribeList(member); + mySubscribeList.stream().forEach( + mySubscribe->{ + Long issueId = mySubscribe.getIssueId(); + + IssueDto issueDto = findKeywordFeignClient. + getIssueByIssueId(issueId).getBody().getData(); + mySubscribe.updateIssue(issueDto.getIssueTitle()); + } + ); + return mySubscribeList; } } diff --git a/src/main/java/gwangjang/server/domain/subscribe/presentation/SubscribeController.java b/src/main/java/gwangjang/server/domain/subscribe/presentation/SubscribeController.java index c523ff4..ada1373 100644 --- a/src/main/java/gwangjang/server/domain/subscribe/presentation/SubscribeController.java +++ b/src/main/java/gwangjang/server/domain/subscribe/presentation/SubscribeController.java @@ -74,7 +74,7 @@ public ResponseEntity> getIssueSubscriber * @return */ @GetMapping("/subscribe/contents") - public ResponseEntity>> getMySubscribeIssueList(@RequestHeader(value = "user-id") String socialId) { + public ResponseEntity>> getMySubscribeIssueList(@RequestHeader(value = "user-id") String socialId) { return ResponseEntity.ok(SuccessResponse.create(GET_MY_SUBSCRIBES_SUCCESS.getMessage(), this.subscribeContentsUseCase.getMySubscribeIssueList(socialId))); }