Skip to content

Commit

Permalink
feat: 이슈 디테일 페이지 요청에 response 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
eNoLJ committed Jun 22, 2021
1 parent 4b25d45 commit ef793cc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions BE/src/main/java/com/issuetracker/domain/comment/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<CommentDTO> comments;
private final List<Assignee> assignees;
private final List<LabelDTO> labels;
private final MilestoneDTO milestone;

public static IssueDetailPageResponseDTO of(Issue issue, List<CommentDTO> comments, List<Assignee> assignees, List<LabelDTO> labels, MilestoneDTO milestone) {
public static IssueDetailPageResponseDTO of(Issue issue, UserResponseDTO owner, List<CommentDTO> comments, List<Assignee> assignees, List<LabelDTO> 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)
Expand Down

0 comments on commit ef793cc

Please sign in to comment.