Skip to content

Commit

Permalink
Merge pull request #16 from kusitms-28th-Meetup-E/feat/community
Browse files Browse the repository at this point in the history
fix : ContentsDto 변경
  • Loading branch information
seungueonn authored Nov 22, 2023
2 parents 3867125 + 1f9b6d3 commit c9e9272
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void updateMemberDto(MemberDto memberDto) {
}

public void updateContentsDto(ContentsDto contentsDto) {
this.area = contentsDto.getTopicTitle();
this.area = contentsDto.getTopic();
this.subject = contentsDto.getIssueTitle();
this.keyword = contentsDto.getKeyword();
this.contents = contentsDto.getUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ContentsDto {
private String issueTitle;
private String keyword;
private String pubDate;
private String topicTitle;
private String topic;
private String imgUrl;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public Community mapToCommunity(String memberId, ContentsDto contentsDto, Commun
.writerId(memberId)
.keyword(contentsDto.getKeyword())
.issue(contentsDto.getIssueTitle())
.topic(contentsDto.getTopicTitle())
.topic(contentsDto.getTopic())
.build();
}

Expand All @@ -32,7 +32,7 @@ public CommunityRes mapToCommunityRes(Community community, MemberDto memberDto,
.contents(contentsDto.getUrl())
.keyword(contentsDto.getKeyword())
.subject(contentsDto.getIssueTitle())
.area(contentsDto.getTopicTitle())
.area(contentsDto.getTopic())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gwangjang.server.domain.community.domain.service;

import gwangjang.server.domain.community.application.dto.res.CommunityRes;
import gwangjang.server.domain.community.application.dto.res.ContentsDto;
import gwangjang.server.domain.community.application.dto.res.MemberDto;
import gwangjang.server.domain.community.application.dto.res.SearchRes;
import gwangjang.server.domain.community.application.mapper.CommunityMapper;
Expand All @@ -9,6 +10,7 @@
import gwangjang.server.domain.community.domain.repository.CommunityRepository;
import gwangjang.server.domain.community.exception.NotFoundCommunityException;
import gwangjang.server.global.annotation.DomainService;
import gwangjang.server.global.feign.client.FindContentsFeignClient;
import gwangjang.server.global.feign.client.FindMemberFeignClient;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -25,6 +27,7 @@ public class CommunityQueryService {

private final CommunityRepository communityRepository;
private final FindMemberFeignClient findMemberFeignClient;
private final FindContentsFeignClient findContentsFeignClient;

private final CommunityMapper communityMapper = new CommunityMapper();

Expand All @@ -40,6 +43,10 @@ public List<CommunityRes> getAllCommunityByTopic(String memberId,String topic) {
String writerId = communityRes1.getWriterId();
MemberDto memberDto = findMemberFeignClient.getMemberBySocialId(writerId);
communityRes1.updateMemberDto(memberDto);
Long contentsId = communityRes1.getContentsId();
ContentsDto contentsDto = findContentsFeignClient.getContents(contentsId).getBody().getData();
communityRes1.updateContentsDto(contentsDto);

}
);

Expand All @@ -53,6 +60,10 @@ public List<CommunityRes> getAllCommunity(String memberId) {
String writerId = communityRes1.getWriterId();
MemberDto memberDto = findMemberFeignClient.getMemberBySocialId(writerId);
communityRes1.updateMemberDto(memberDto);

Long contentsId = communityRes1.getContentsId();
ContentsDto contentsDto = findContentsFeignClient.getContents(contentsId).getBody().getData();
communityRes1.updateContentsDto(contentsDto);
}
);

Expand All @@ -67,6 +78,11 @@ public CommunityRes getCommunity(String memberId,Long communityId) {
MemberDto memberDto = findMemberFeignClient.getMemberBySocialId(writerId);
communityRes.updateMemberDto(memberDto);


Long contentsId = communityRes.getContentsId();
ContentsDto contentsDto = findContentsFeignClient.getContents(contentsId).getBody().getData();
communityRes.updateContentsDto(contentsDto);

return communityRes;
}

Expand All @@ -80,6 +96,10 @@ public List<CommunityRes> getCommunityTop5(String memberId,CommunityOrderConditi
String writerId = communityRes1.getWriterId();
MemberDto memberDto = findMemberFeignClient.getMemberBySocialId(writerId);
communityRes1.updateMemberDto(memberDto);

Long contentsId = communityRes1.getContentsId();
ContentsDto contentsDto = findContentsFeignClient.getContents(contentsId).getBody().getData();
communityRes1.updateContentsDto(contentsDto);
}
);

Expand All @@ -95,6 +115,11 @@ public List<CommunityRes> getCommunityByMyHearts(String memberId) {
String writerId = communityRes1.getWriterId();
MemberDto memberDto = findMemberFeignClient.getMemberBySocialId(writerId);
communityRes1.updateMemberDto(memberDto);


Long contentsId = communityRes1.getContentsId();
ContentsDto contentsDto = findContentsFeignClient.getContents(contentsId).getBody().getData();
communityRes1.updateContentsDto(contentsDto);
}
);

Expand All @@ -110,6 +135,11 @@ public List<CommunityRes> getCommunityByMyId(String memberId) {
String writerId = communityRes1.getWriterId();
MemberDto memberDto = findMemberFeignClient.getMemberBySocialId(writerId);
communityRes1.updateMemberDto(memberDto);


Long contentsId = communityRes1.getContentsId();
ContentsDto contentsDto = findContentsFeignClient.getContents(contentsId).getBody().getData();
communityRes1.updateContentsDto(contentsDto);
}
);
return communityRes;
Expand Down

0 comments on commit c9e9272

Please sign in to comment.