Refactor: Comment 응답형식 변경

This commit is contained in:
김용수 2024-09-19 12:17:09 +09:00
parent ac31876961
commit 07b2ea9a15

View File

@ -1,6 +1,7 @@
package com.worlabel.domain.comment.entity.dto; package com.worlabel.domain.comment.entity.dto;
import com.worlabel.domain.comment.entity.Comment; import com.worlabel.domain.comment.entity.Comment;
import com.worlabel.domain.member.entity.dto.MemberResponse;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@ -15,14 +16,8 @@ public class CommentResponse {
@Schema(description = "댓글 ID", example = "1") @Schema(description = "댓글 ID", example = "1")
private Integer id; private Integer id;
@Schema(description = "작성자 ID", example = "1") @Schema(description = "작성자", example = "")
private Integer memberId; private MemberResponse author;
@Schema(description = "작성자 닉네임", example = "javajoha")
private String memberNickname;
@Schema(description = "작성자 프로필", example = "profile.jpg")
private String memberProfileImage;
@Schema(description = "y좌표", example = "3.16324") @Schema(description = "y좌표", example = "3.16324")
private double positionY; private double positionY;
@ -38,9 +33,7 @@ public class CommentResponse {
public static CommentResponse from(final Comment comment) { public static CommentResponse from(final Comment comment) {
return new CommentResponse(comment.getId(), return new CommentResponse(comment.getId(),
comment.getMember().getId(), MemberResponse.of(comment.getMember()),
comment.getMember().getNickname(),
comment.getMember().getProfileImage(),
comment.getPositionY(), comment.getPositionY(),
comment.getPositionX(), comment.getPositionX(),
comment.getContent(), comment.getContent(),