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 @@ -166,6 +166,8 @@ public record PreviewCommentResponse(
Long commentId,
String displayName,
String content,
// true면 프론트는 미리보기 댓글에 "사진 보기" 버튼을 노출하고 질문 상세 페이지로 이동시킨다.
Boolean hasImage,
LocalDateTime createdAt
) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public interface QuestionCommentRepository extends JpaRepository<QuestionComment
ranked.user_id AS "userId",
u.role AS "userRole",
ranked.content AS "content",
ranked.image_url AS "imageUrl",
ranked.created_at AS "createdAt",
qai.anonymous_no AS "anonymousNo"
FROM (
Expand Down Expand Up @@ -80,6 +81,8 @@ interface PreviewCommentRow {

String getContent();

String getImageUrl();

LocalDateTime getCreatedAt();

Integer getAnonymousNo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,15 @@ private QuestionResDTO.PreviewCommentResponse toPreviewCommentResponse(
row.getCommentId(),
getPreviewDisplayName(question, row),
row.getContent(),
hasPreviewImage(row),
row.getCreatedAt()
);
}

private boolean hasPreviewImage(QuestionCommentRepository.PreviewCommentRow row) {
return row.getImageUrl() != null && !row.getImageUrl().isBlank();
}

private String getPreviewDisplayName(Question question, QuestionCommentRepository.PreviewCommentRow row) {
if (row.getUserId().equals(question.getUser().getId())) {
return "작성자";
Expand Down
Loading