Skip to content

Commit

Permalink
✨ Feat: 댓글 관련 dto 형식 통일
Browse files Browse the repository at this point in the history
  • Loading branch information
ShimFFF committed Aug 21, 2024
1 parent 218d022 commit ee8c801
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public Page<RoomPostResponseDto.CommentWithRepliesDTO> getCommentsWithReplies(Lo
private RoomPostResponseDto.CommentWithRepliesDTO convertToCommentWithRepliesDTO(InfoPostComment comment) {
RoomPostResponseDto.CommentWithRepliesDTO dto = new RoomPostResponseDto.CommentWithRepliesDTO();
dto.setId(comment.getId());
dto.setAuthorName(comment.getUser().getName());
dto.setBody(comment.getBody());
dto.setCreatedAt(comment.getCreatedAt());
dto.setUserNickName(comment.getUser().getName());
dto.setCommentBody(comment.getBody());
dto.setCommentWriteDate(comment.getCreatedAt());
dto.setReplies(comment.getReplies().stream()
.sorted(Comparator.comparing(InfoPostComment::getCreatedAt))
.map(this::convertToCommentDTO)
Expand All @@ -124,9 +124,9 @@ private RoomPostResponseDto.CommentWithRepliesDTO convertToCommentWithRepliesDTO
private RoomPostResponseDto.CommentDTO convertToCommentDTO(InfoPostComment reply) {
RoomPostResponseDto.CommentDTO dto = new RoomPostResponseDto.CommentDTO();
dto.setId(reply.getId());
dto.setAuthorName(reply.getUser().getName());
dto.setBody(reply.getBody());
dto.setCreatedAt(reply.getCreatedAt());
dto.setUserNickName(reply.getUser().getName());
dto.setCommentBody(reply.getBody());
dto.setCommentWriteDate(reply.getCreatedAt());
return dto;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ public Page<RoomPostResponseDto.CommentWithRepliesDTO> getCommentsWithReplies(Lo
private RoomPostResponseDto.CommentWithRepliesDTO convertToCommentWithRepliesDTO(PostComment comment) {
RoomPostResponseDto.CommentWithRepliesDTO dto = new RoomPostResponseDto.CommentWithRepliesDTO();
dto.setId(comment.getId());
dto.setAuthorName(comment.getUser().getName());
dto.setBody(comment.getBody());
dto.setCreatedAt(comment.getCreatedAt());
dto.setUserNickName(comment.getUser().getName());
dto.setCommentBody(comment.getBody());
dto.setCommentWriteDate(comment.getCreatedAt());
dto.setReplies(comment.getReplies().stream()
.sorted(Comparator.comparing(PostComment::getCreatedAt))
.map(this::convertToCommentDTO)
Expand All @@ -145,9 +145,9 @@ private RoomPostResponseDto.CommentWithRepliesDTO convertToCommentWithRepliesDTO
private RoomPostResponseDto.CommentDTO convertToCommentDTO(PostComment reply) {
RoomPostResponseDto.CommentDTO dto = new RoomPostResponseDto.CommentDTO();
dto.setId(reply.getId());
dto.setAuthorName(reply.getUser().getName());
dto.setBody(reply.getBody());
dto.setCreatedAt(reply.getCreatedAt());
dto.setUserNickName(reply.getUser().getName());
dto.setCommentBody(reply.getBody());
dto.setCommentWriteDate(reply.getCreatedAt());
return dto;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public Page<RoomPostResponseDto.CommentWithRepliesDTO> getCommentsWithReplies(Lo
private RoomPostResponseDto.CommentWithRepliesDTO convertToCommentWithRepliesDTO(TroublePostComment comment) {
RoomPostResponseDto.CommentWithRepliesDTO dto = new RoomPostResponseDto.CommentWithRepliesDTO();
dto.setId(comment.getId());
dto.setAuthorName(comment.getUser().getName());
dto.setBody(comment.getBody());
dto.setCreatedAt(comment.getCreatedAt());
dto.setUserNickName(comment.getUser().getName());
dto.setCommentBody(comment.getBody());
dto.setCommentWriteDate(comment.getCreatedAt());
dto.setReplies(comment.getReplies().stream()
.sorted(Comparator.comparing(TroublePostComment::getCreatedAt))
.map(this::convertToCommentDTO)
Expand All @@ -117,9 +117,9 @@ private RoomPostResponseDto.CommentWithRepliesDTO convertToCommentWithRepliesDTO
private RoomPostResponseDto.CommentDTO convertToCommentDTO(TroublePostComment reply) {
RoomPostResponseDto.CommentDTO dto = new RoomPostResponseDto.CommentDTO();
dto.setId(reply.getId());
dto.setAuthorName(reply.getUser().getName());
dto.setBody(reply.getBody());
dto.setCreatedAt(reply.getCreatedAt());
dto.setUserNickName(reply.getUser().getName());
dto.setCommentBody(reply.getBody());
dto.setCommentWriteDate(reply.getCreatedAt());
return dto;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,19 @@ public static class TroublePostDetailDTO {
@Setter
public static class CommentWithRepliesDTO {
private Long id;
private String authorName;
private String body;
private LocalDateTime createdAt;
private String userNickName;
private String commentBody;
private LocalDateTime commentWriteDate;
private List<CommentDTO> replies;
}

@Getter
@Setter
public static class CommentDTO {
private Long id;
private String authorName;
private String body;
private LocalDateTime createdAt;
private String userNickName;
private String commentBody;
private LocalDateTime commentWriteDate;
}

@Getter
Expand Down

0 comments on commit ee8c801

Please sign in to comment.