Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public static Comment WriteCommentDtoToComment(CommentRequestDTO.WriteCommentDto

public static CommentResponseDTO.WriteCommentResponseDTO CommentToWriteCommentResponseDTO(Comment comment){
return CommentResponseDTO.WriteCommentResponseDTO.builder()
.nameId(comment.getUser().getNameId())
.profileImageUrl(comment.getUser().getProfileImageUrl())
.nickname(comment.getUser().getNickname())
Comment on lines +24 to +26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

코드 가독성과 유지보수성을 향상시키기 위해, CommentConverter에서 WriteCommentResponseDTO 객체를 생성할 때 빌더의 메서드 호출 순서를 DTO 클래스에 선언된 필드 순서(nameId, nickname, profileImageUrl)와 동일하게 맞추는 것을 제안합니다. 이렇게 하면 코드를 읽는 사람이 DTO의 구조를 더 쉽게 파악할 수 있습니다.

Suggested change
.nameId(comment.getUser().getNameId())
.profileImageUrl(comment.getUser().getProfileImageUrl())
.nickname(comment.getUser().getNickname())
.nameId(comment.getUser().getNameId())
.nickname(comment.getUser().getNickname())
.profileImageUrl(comment.getUser().getProfileImageUrl())

.commentId(comment.getId())
.parentCommentId(comment.getParentComment()==null?null:comment.getParentComment().getId())
.cardId(comment.getCard().getId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ public class CommentResponseDTO {
@AllArgsConstructor
@NoArgsConstructor
public static class WriteCommentResponseDTO{

@NotNull
private String nameId;
@NotNull
private String nickname;
@NotNull
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @NotNull annotations on these fields may cause validation issues if any user fields are null in the database. Consider using @nullable or handling null values appropriately, especially for profileImageUrl which might be optional.

Suggested change
@NotNull

Copilot uses AI. Check for mistakes.
private String profileImageUrl;
Comment on lines +22 to +23

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

User 엔티티의 profileImageUrl 필드는 null 값을 가질 수 있습니다. 하지만 WriteCommentResponseDTO에서는 이 필드를 @NotNull로 지정하고 있어, 프로필 이미지가 없는 사용자의 댓글 생성 시 응답 데이터가 DTO의 제약 조건에 위배될 수 있습니다. 이는 클라이언트 측에서 예기치 않은 오류를 발생시킬 수 있으므로, @NotNull 어노테이션을 제거하여 실제 데이터 모델을 정확하게 반영하는 것이 좋습니다.

Suggested change
@NotNull
private String profileImageUrl;
private String profileImageUrl;


@NotNull
private Long commentId;
@NotNull
Expand All @@ -24,6 +32,7 @@ public static class WriteCommentResponseDTO{
private Long userId;
@NotNull
private String content;

}

@Getter
Expand Down
Loading