Skip to content

Commit

Permalink
Feat: 누락된 API 응답 값 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kwondongwook committed Dec 13, 2023
1 parent ae55c33 commit 3ee93f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ private static class ArticleDto {
private Long writerId;
private String writerNickname;
private String writerRole;
private LocalDateTime createdAt;
private long viewCount;
private long likeCount;
private LocalDateTime createdAt;

private static ArticleDto of(Article article) {
Member writer = article.getWriter();
Expand All @@ -56,8 +57,9 @@ private static ArticleDto of(Article article) {
.writerId(writer.getId())
.writerNickname(writer.getNickname())
.writerRole(writer.getRole().name())
.createdAt(article.getCreatedAt())
.viewCount(article.getViewCount())
.likeCount(article.getLikeCount())
.createdAt(article.getCreatedAt())
.build();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ public class ReadArticleResponse {
private Long writerId;
private String writerNickname;
private String writerRole;
private String writerProfileImg;
private String content;
private long viewCount;
private long likeCount;
private LocalDateTime createdAt;
private Long interestArticleId;

Expand All @@ -29,9 +31,11 @@ public static ReadArticleResponse of(Article article, InterestArticle interestAr
.title(article.getTitle())
.writerId(writer.getId())
.writerNickname(writer.getNickname())
.writerProfileImg(writer.getProfileImg())
.writerRole(writer.getRole().name())
.content(article.getContent())
.viewCount(article.getViewCount())
.viewCount(article.getViewCount() + 1)
.likeCount(article.getLikeCount())
.createdAt(article.getCreatedAt())
.interestArticleId(interestArticle != null ? interestArticle.getId() : null)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private static class CommentDto {
private Long commentId;
private Long writerId;
private String writerNickname;
private String writerProfileImg;
private Long articleId;
private String content;
private Long parentId;
Expand All @@ -58,6 +59,7 @@ private static CommentDto of(Comment comment) {
.commentId(comment.getId())
.writerId(comment.getWriter().getId())
.writerNickname(comment.getWriter().getNickname())
.writerProfileImg(comment.getWriter().getProfileImg())
.articleId(comment.getArticle().getId())
.content(comment.getContent())
.parentId(comment.getParent() != null ? comment.getParent().getId() : null)
Expand Down

0 comments on commit 3ee93f6

Please sign in to comment.