diff --git a/src/main/java/com/example/umc3_teamproject/domain/dto/response/ForumResponseDto.java b/src/main/java/com/example/umc3_teamproject/domain/dto/response/ForumResponseDto.java index 56b818c..7d22759 100644 --- a/src/main/java/com/example/umc3_teamproject/domain/dto/response/ForumResponseDto.java +++ b/src/main/java/com/example/umc3_teamproject/domain/dto/response/ForumResponseDto.java @@ -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; diff --git a/src/main/java/com/example/umc3_teamproject/service/ForumService.java b/src/main/java/com/example/umc3_teamproject/service/ForumService.java index 9f2c3ee..6f89d36 100644 --- a/src/main/java/com/example/umc3_teamproject/service/ForumService.java +++ b/src/main/java/com/example/umc3_teamproject/service/ForumService.java @@ -111,7 +111,7 @@ public ResponseTemplate 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())); } @@ -302,6 +302,7 @@ public ResponseTemplate 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(), @@ -386,6 +387,7 @@ public ResponseTemplate 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()) @@ -473,7 +475,7 @@ public ResponseTemplate> getSixForum private ResponseTemplate> getListFroumDataToGetResult(List forums) { List 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()) @@ -485,7 +487,7 @@ private ResponseTemplate> getListFro private ResponsePageTemplate> getListFroumDataToPage(List forums,Pageable pageable,Long total_page) { List 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())