From 3ee93f6427e61357bf7862077657908b9cd1fe83 Mon Sep 17 00:00:00 2001 From: kwondongwook Date: Thu, 14 Dec 2023 00:21:22 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EB=88=84=EB=9D=BD=EB=90=9C=20API=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EA=B0=92=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/article/controller/dto/GetArticlesResponse.java | 6 ++++-- .../domain/article/controller/dto/ReadArticleResponse.java | 6 +++++- .../domain/comment/controller/dto/GetCommentsResponse.java | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/api/trip/domain/article/controller/dto/GetArticlesResponse.java b/src/main/java/com/api/trip/domain/article/controller/dto/GetArticlesResponse.java index c8f9f73..d4c86f6 100644 --- a/src/main/java/com/api/trip/domain/article/controller/dto/GetArticlesResponse.java +++ b/src/main/java/com/api/trip/domain/article/controller/dto/GetArticlesResponse.java @@ -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(); @@ -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(); } } diff --git a/src/main/java/com/api/trip/domain/article/controller/dto/ReadArticleResponse.java b/src/main/java/com/api/trip/domain/article/controller/dto/ReadArticleResponse.java index f3ae41f..f853c14 100644 --- a/src/main/java/com/api/trip/domain/article/controller/dto/ReadArticleResponse.java +++ b/src/main/java/com/api/trip/domain/article/controller/dto/ReadArticleResponse.java @@ -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; @@ -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(); diff --git a/src/main/java/com/api/trip/domain/comment/controller/dto/GetCommentsResponse.java b/src/main/java/com/api/trip/domain/comment/controller/dto/GetCommentsResponse.java index 95f86d4..d615b8d 100644 --- a/src/main/java/com/api/trip/domain/comment/controller/dto/GetCommentsResponse.java +++ b/src/main/java/com/api/trip/domain/comment/controller/dto/GetCommentsResponse.java @@ -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; @@ -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)