Skip to content

Commit

Permalink
[fix] #98 forum responsebody에 comment_num 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
myhyun0002 committed Feb 9, 2023
1 parent f61a7b8 commit 713325c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public static class ForumDataToGetResult {
@ApiParam(value = "해당 forum의 interview 수", required = false, example = "100")
private int interview_num;

@ApiParam(value = "해당 forum의 comment 수", required = false, example = "100")
private int comment_num;

@ApiParam(value = "해당 forum의 이미지나 비디오 수", required = false, example = "100")
private int image_video_num;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public ResponseTemplate<ForumResponseDto.ForumDataToGetResult> createForum(Long

forumRepository.save(forum);
return new ResponseTemplate<>(new ForumResponseDto.ForumDataToGetResult(forum.getMember().getId(),forum.getMember().getNickName(),forum.getId(),
forum.getTitle(),forum.getContent(),forum.getLike_num(),scriptIdToRequests.size(),interviewIdsToRequests.size(),postImages.size(),
forum.getTitle(),forum.getContent(),forum.getLike_num(),scriptIdToRequests.size(),interviewIdsToRequests.size(),0,postImages.size(),
scriptIdToRequests,interviewIdsToRequests,postImages,forum.getCreatedDate(),forum.getModifiedDate()));
}

Expand Down Expand Up @@ -302,6 +302,7 @@ public ResponseTemplate<ForumResponseDto.ForumDataToGetResult> updateForum(Long
findForum.getMember().getNickName(),findForum.getId(),findForum.getTitle(),findForum.getContent(),findForum.getLike_num(),
script_num,
interview_num,
findForum.getComments().size(),
findForum.getForumImages().size(),
request.getScriptIds(),
request.getInterviewIds(),
Expand Down Expand Up @@ -386,6 +387,7 @@ public ResponseTemplate<ForumResponseDto.ForumDataToGetResult> getForumByForumId
forum.getLike_num(),
forum.getForumScripts().size(),
forum.getForumInterviews().size(),
forum.getComments().size(),
forum.getForumImages().size(),
forum.getForumScripts().stream().map(
i -> new ForumRequestDto.ScriptIdsToRequest(i.getScript().getScriptId())
Expand Down Expand Up @@ -473,7 +475,7 @@ public ResponseTemplate<List<ForumResponseDto.ForumDataToGetResult>> getSixForum
private ResponseTemplate<List<ForumResponseDto.ForumDataToGetResult>> getListFroumDataToGetResult(List<Forum> forums) {
List<ForumResponseDto.ForumDataToGetResult> forumDataToGetResultRespons = forums.stream().map(
s -> new ForumResponseDto.ForumDataToGetResult(s.getMember().getId(),s.getMember().getNickName(),s.getId(),s.getTitle(),s.getContent(),s.getLike_num(),
s.getForumScripts().size(),s.getForumInterviews().size(),s.getForumImages().size(),
s.getForumScripts().size(),s.getForumInterviews().size(),s.getComments().size(),s.getForumImages().size(),
s.getForumScripts().stream().map(i -> new ForumRequestDto.ScriptIdsToRequest(i.getScript().getScriptId())).collect(Collectors.toList()),
s.getForumInterviews().stream().map(i -> new ForumRequestDto.InterviewIdsToRequest(i.getInterview().getInterviewId())).collect(Collectors.toList()),
s.getForumImages().stream().map(ForumImage::getImageUrl).collect(Collectors.toList())
Expand All @@ -485,7 +487,7 @@ private ResponseTemplate<List<ForumResponseDto.ForumDataToGetResult>> getListFro
private ResponsePageTemplate<List<ForumResponseDto.ForumDataToGetResult>> getListFroumDataToPage(List<Forum> forums,Pageable pageable,Long total_page) {
List<ForumResponseDto.ForumDataToGetResult> forumDataToGetResultRespons = forums.stream().map(
s -> new ForumResponseDto.ForumDataToGetResult(s.getMember().getId(),s.getMember().getNickName(),s.getId(),s.getTitle(),s.getContent(),s.getLike_num(),
s.getForumScripts().size(),s.getForumInterviews().size(),s.getForumImages().size(),
s.getForumScripts().size(),s.getForumInterviews().size(),s.getComments().size(),s.getForumImages().size(),
s.getForumScripts().stream().map(i -> new ForumRequestDto.ScriptIdsToRequest(i.getScript().getScriptId())).collect(Collectors.toList()),
s.getForumInterviews().stream().map(i -> new ForumRequestDto.InterviewIdsToRequest(i.getInterview().getInterviewId())).collect(Collectors.toList()),
s.getForumImages().stream().map(ForumImage::getImageUrl).collect(Collectors.toList())
Expand Down

0 comments on commit 713325c

Please sign in to comment.