From ef793ccab2c852317212cb2a126f8129b31006fe Mon Sep 17 00:00:00 2001 From: jeong-inho Date: Tue, 22 Jun 2021 16:04:55 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9D=B4=EC=8A=88=20=EB=94=94=ED=85=8C?= =?UTF-8?q?=EC=9D=BC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9A=94=EC=B2=AD?= =?UTF-8?q?=EC=97=90=20response=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/main/java/com/issuetracker/domain/comment/Comment.java | 4 ++++ .../main/java/com/issuetracker/service/IssueQueryService.java | 1 + .../java/com/issuetracker/web/dto/response/CommentDTO.java | 2 ++ .../web/dto/response/IssueDetailPageResponseDTO.java | 4 +++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/BE/src/main/java/com/issuetracker/domain/comment/Comment.java b/BE/src/main/java/com/issuetracker/domain/comment/Comment.java index 5465c1c29..4d321588a 100644 --- a/BE/src/main/java/com/issuetracker/domain/comment/Comment.java +++ b/BE/src/main/java/com/issuetracker/domain/comment/Comment.java @@ -44,6 +44,10 @@ public String getAuthorName() { return author.getUserName(); } + public String getAuthorAvatarUrl() { + return author.getAvatarUrl(); + } + public boolean matchAuthor(User user) { return author.equals(user); } diff --git a/BE/src/main/java/com/issuetracker/service/IssueQueryService.java b/BE/src/main/java/com/issuetracker/service/IssueQueryService.java index 1175cc7ee..261381315 100644 --- a/BE/src/main/java/com/issuetracker/service/IssueQueryService.java +++ b/BE/src/main/java/com/issuetracker/service/IssueQueryService.java @@ -51,6 +51,7 @@ public IssueDetailPageResponseDTO getDetailPage(Long issueId, Long userId) { User loginUser = userService.findUserById(userId); return IssueDetailPageResponseDTO.of( issue, + UserResponseDTO.of(issue.getAuthor()), commentsToCommentDTOs(loginUser, issue), userService.getCheckedAssignees(issue), labelService.getCheckedLabels(issue), diff --git a/BE/src/main/java/com/issuetracker/web/dto/response/CommentDTO.java b/BE/src/main/java/com/issuetracker/web/dto/response/CommentDTO.java index ea8dc52f4..4bd315097 100644 --- a/BE/src/main/java/com/issuetracker/web/dto/response/CommentDTO.java +++ b/BE/src/main/java/com/issuetracker/web/dto/response/CommentDTO.java @@ -20,6 +20,7 @@ public class CommentDTO { private final String userName; private final String comment; private final LocalDateTime createdDateTime; + private final String avatarUrl; private final boolean isOwner; private final boolean isAuthor; @@ -29,6 +30,7 @@ public static CommentDTO createCommentDTO(User loginUser, Issue issue, Comment c .userName(comment.getAuthorName()) .comment(comment.getComment()) .createdDateTime(comment.getCreatedDateTime()) + .avatarUrl(comment.getAuthorAvatarUrl()) .isOwner(comment.matchAuthor(issue.getAuthor())) .isAuthor(comment.matchAuthor(loginUser)) .build(); diff --git a/BE/src/main/java/com/issuetracker/web/dto/response/IssueDetailPageResponseDTO.java b/BE/src/main/java/com/issuetracker/web/dto/response/IssueDetailPageResponseDTO.java index 9fa3df475..b994eefc6 100644 --- a/BE/src/main/java/com/issuetracker/web/dto/response/IssueDetailPageResponseDTO.java +++ b/BE/src/main/java/com/issuetracker/web/dto/response/IssueDetailPageResponseDTO.java @@ -17,17 +17,19 @@ public class IssueDetailPageResponseDTO { private final String title; private final boolean status; private final LocalDateTime createdDateTime; + private final UserResponseDTO owner; private final List comments; private final List assignees; private final List labels; private final MilestoneDTO milestone; - public static IssueDetailPageResponseDTO of(Issue issue, List comments, List assignees, List labels, MilestoneDTO milestone) { + public static IssueDetailPageResponseDTO of(Issue issue, UserResponseDTO owner, List comments, List assignees, List labels, MilestoneDTO milestone) { return IssueDetailPageResponseDTO.builder() .id(issue.getId()) .title(issue.getTitle()) .status(issue.isOpen()) .createdDateTime(issue.getCreatedDateTime()) + .owner(owner) .comments(comments) .assignees(assignees) .labels(labels)