Skip to content

Commit ebffbe9

Browse files
committed
refactor: 댓글 정보 반환 DTO에 포스트 ID와 카테고리 추가
1 parent 8c12237 commit ebffbe9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • src/main/java/com/back/web7_9_codecrete_be/domain/community/comment/dto/response

src/main/java/com/back/web7_9_codecrete_be/domain/community/comment/dto/response/CommentResponse.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.back.web7_9_codecrete_be.domain.community.comment.dto.response;
22

33
import com.back.web7_9_codecrete_be.domain.community.comment.entity.Comment;
4+
import com.back.web7_9_codecrete_be.domain.community.post.entity.PostCategory;
45
import io.swagger.v3.oas.annotations.media.Schema;
56
import lombok.Builder;
67
import lombok.Getter;
@@ -18,6 +19,12 @@ public class CommentResponse {
1819
@Schema(description = "작성자 사용자 ID", example = "12")
1920
private Long userId;
2021

22+
@Schema(description = "포스트 ID", example = "3")
23+
private Long postId;
24+
25+
@Schema(description = "포스트 카테고리", example = "JOIN")
26+
private PostCategory postCategory;
27+
2128
@Schema(description = "댓글 내용", example = "정말 공감합니다!")
2229
private String content;
2330

@@ -34,6 +41,8 @@ public static CommentResponse from(Comment comment) {
3441
return CommentResponse.builder()
3542
.commentId(comment.getCommentId())
3643
.userId(comment.getUserId())
44+
.postId(comment.getPost().getPostId())
45+
.postCategory(comment.getPost().getCategory())
3746
.content(comment.getContent())
3847
.createdDate(comment.getCreatedDate())
3948
.modifiedDate(comment.getModifiedDate())

0 commit comments

Comments
 (0)