From 2219c368e9963f533e7cc89a1f101a611087b0b2 Mon Sep 17 00:00:00 2001 From: DongHoon Lee <125895298+hoonyworld@users.noreply.github.com> Date: Mon, 23 Sep 2024 02:14:17 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20isBlockedComment=EB=A5=BC=20Lombok?= =?UTF-8?q?=20getter=EC=97=90=EC=84=9C=20=EC=83=9D=EB=9E=B5=20=ED=9B=84=20?= =?UTF-8?q?=EC=A7=81=EC=A0=91=20getter=20=EA=B5=AC=ED=98=84=20=20(#400)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(CommentDto): Lombok getter에서 isBlockedComment를 생략 후 직접 getter 구현 * refactor(ReplyDto): Lombok getter에서 isBlockedComment를 생략 후 직접 getter 구현 --- .../main/comment/v2/dto/response/CommentDto.java | 15 +++++++++------ .../main/comment/v2/dto/response/ReplyDto.java | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/main/src/main/java/org/sopt/makers/crew/main/comment/v2/dto/response/CommentDto.java b/main/src/main/java/org/sopt/makers/crew/main/comment/v2/dto/response/CommentDto.java index 49d0dc97..281f4637 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/comment/v2/dto/response/CommentDto.java +++ b/main/src/main/java/org/sopt/makers/crew/main/comment/v2/dto/response/CommentDto.java @@ -2,16 +2,14 @@ import java.time.LocalDateTime; import java.util.List; -import java.util.Optional; import org.sopt.makers.crew.main.entity.comment.Comment; -import org.sopt.makers.crew.main.entity.user.User; -import com.fasterxml.jackson.annotation.JsonProperty; import com.querydsl.core.annotations.QueryProjection; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; +import lombok.AccessLevel; import lombok.Getter; @Getter @@ -55,12 +53,13 @@ public class CommentDto { private final List replies; @Schema(description = "차단여부", example = "false") + @Getter(AccessLevel.NONE) @NotNull - private final Boolean isBlockedComment; + private final boolean isBlockedComment; @QueryProjection public CommentDto(Integer id, String contents, CommentWriterDto user, LocalDateTime createdDate, int likeCount, - boolean isLiked, boolean isWriter, int order, List replies, Boolean isBlockedComment) { + boolean isLiked, boolean isWriter, int order, List replies, boolean isBlockedComment) { this.id = id; this.contents = contents; this.user = user; @@ -74,7 +73,7 @@ public CommentDto(Integer id, String contents, CommentWriterDto user, LocalDateT } public static CommentDto of(Comment comment, boolean isLiked, boolean isWriter, List replies, - Boolean isBlockedComment) { + boolean isBlockedComment) { Integer userId = comment.getUser() == null ? null : comment.getUser().getId(); Integer orgId = comment.getUser() == null ? null : comment.getUser().getOrgId(); String userName = comment.getUser() == null ? null : comment.getUser().getName(); @@ -85,4 +84,8 @@ public static CommentDto of(Comment comment, boolean isLiked, boolean isWriter, profileImage), comment.getCreatedDate(), comment.getLikeCount(), isLiked, isWriter, comment.getOrder(), replies, isBlockedComment); } + + public boolean getIsBlockedComment() { + return isBlockedComment; + } } diff --git a/main/src/main/java/org/sopt/makers/crew/main/comment/v2/dto/response/ReplyDto.java b/main/src/main/java/org/sopt/makers/crew/main/comment/v2/dto/response/ReplyDto.java index cf72f3ff..e9c783ba 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/comment/v2/dto/response/ReplyDto.java +++ b/main/src/main/java/org/sopt/makers/crew/main/comment/v2/dto/response/ReplyDto.java @@ -1,10 +1,14 @@ package org.sopt.makers.crew.main.comment.v2.dto.response; import java.time.LocalDateTime; + import org.sopt.makers.crew.main.entity.comment.Comment; + import com.querydsl.core.annotations.QueryProjection; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; +import lombok.AccessLevel; import lombok.Getter; @Getter @@ -44,12 +48,13 @@ public class ReplyDto { private final int order; @Schema(description = "차단여부", example = "false") + @Getter(AccessLevel.NONE) @NotNull - private final Boolean isBlockedComment; + private final boolean isBlockedComment; @QueryProjection public ReplyDto(Integer id, String contents, CommentWriterDto user, LocalDateTime createdDate, int likeCount, - Boolean isLiked, Boolean isWriter, int order, Boolean isBlockedComment) { + Boolean isLiked, Boolean isWriter, int order, boolean isBlockedComment) { this.id = id; this.contents = contents; this.user = user; @@ -61,10 +66,14 @@ public ReplyDto(Integer id, String contents, CommentWriterDto user, LocalDateTim this.isBlockedComment = isBlockedComment; } - public static ReplyDto of(Comment comment, boolean isLiked, boolean isWriter, boolean isBlockedComment) { + public static ReplyDto of(Comment comment, boolean isLiked, boolean isWriter, boolean isBlockedComment) { return new ReplyDto(comment.getId(), comment.getContents(), new CommentWriterDto(comment.getUser().getId(), comment.getUser().getOrgId(), comment.getUser().getName(), comment.getUser().getProfileImage()), comment.getCreatedDate(), comment.getLikeCount(), isLiked, isWriter, comment.getOrder(), isBlockedComment); } + + public boolean getIsBlockedComment() { + return isBlockedComment; + } }