Skip to content

Commit

Permalink
[Refactor/#297] add comment count field in commnet list dto
Browse files Browse the repository at this point in the history
  • Loading branch information
Han-Jeong committed Jun 4, 2024
1 parent 987e07a commit 13b075f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package com.example.waggle.domain.conversation.presentation.converter;

import com.example.waggle.domain.conversation.persistence.entity.Comment;
import com.example.waggle.domain.conversation.presentation.dto.comment.CommentResponse.*;
import com.example.waggle.domain.member.presentation.converter.MemberConverter;
import com.example.waggle.global.util.PageUtil;
import com.example.waggle.domain.conversation.presentation.dto.comment.CommentResponse.CommentListDto;
import com.example.waggle.domain.conversation.presentation.dto.comment.CommentResponse.CommentViewDto;
import com.example.waggle.domain.conversation.presentation.dto.comment.CommentResponse.QuestionCommentListDto;
import com.example.waggle.domain.conversation.presentation.dto.comment.CommentResponse.QuestionCommentViewDto;
import com.example.waggle.domain.conversation.presentation.dto.comment.CommentResponse.SirenCommentListDto;
import com.example.waggle.domain.conversation.presentation.dto.comment.CommentResponse.SirenCommentViewDto;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.stream.Collectors;

import com.example.waggle.domain.member.presentation.converter.MemberConverter;
import org.springframework.data.domain.Page;

public class CommentConverter {

public static CommentViewDto toCommentViewDto(Comment comment) {
Expand All @@ -32,6 +26,7 @@ public static CommentListDto toCommentListDto(Page<Comment> pagedComment) {
return CommentListDto.builder()
.commentList(collect)
.nextPageParam(PageUtil.countNextPage(pagedComment))
.totalCount(pagedComment.getTotalElements())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import com.example.waggle.domain.board.persistence.entity.SirenCategory;
import com.example.waggle.domain.member.presentation.dto.MemberResponse.MemberSummaryDto;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDateTime;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

public class CommentResponse {

@Data
Expand All @@ -35,6 +34,7 @@ public static class CommentViewDto {
public static class CommentListDto {
private List<CommentViewDto> commentList;
private int nextPageParam;
private long totalCount;
}

@Data
Expand Down

0 comments on commit 13b075f

Please sign in to comment.