From c3db676aced7563ed0849622377a38266a8ae21e Mon Sep 17 00:00:00 2001 From: hyxrxn Date: Sun, 22 Dec 2024 16:44:16 +0900 Subject: [PATCH] :recycle: add recipe image to comment list --- .../java/net/pengcook/comment/dto/CommentOfUserResponse.java | 2 ++ .../pengcook/comment/controller/CommentControllerTest.java | 1 + .../java/net/pengcook/comment/service/CommentServiceTest.java | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/net/pengcook/comment/dto/CommentOfUserResponse.java b/backend/src/main/java/net/pengcook/comment/dto/CommentOfUserResponse.java index 586a9263..cb590eca 100644 --- a/backend/src/main/java/net/pengcook/comment/dto/CommentOfUserResponse.java +++ b/backend/src/main/java/net/pengcook/comment/dto/CommentOfUserResponse.java @@ -7,6 +7,7 @@ public record CommentOfUserResponse( long commentId, long recipeId, String recipeTitle, + String recipeThumbnail, LocalDateTime createdAt, String message) { @@ -15,6 +16,7 @@ public CommentOfUserResponse(Comment comment) { comment.getId(), comment.getRecipe().getId(), comment.getRecipe().getTitle(), + comment.getRecipe().getThumbnail(), comment.getCreatedAt(), comment.getMessage()); } diff --git a/backend/src/test/java/net/pengcook/comment/controller/CommentControllerTest.java b/backend/src/test/java/net/pengcook/comment/controller/CommentControllerTest.java index 8c82d777..64f2b8c9 100644 --- a/backend/src/test/java/net/pengcook/comment/controller/CommentControllerTest.java +++ b/backend/src/test/java/net/pengcook/comment/controller/CommentControllerTest.java @@ -187,6 +187,7 @@ void readCommentsOfUserV1() { fieldWithPath("[].commentId").description("댓글 아이디"), fieldWithPath("[].recipeId").description("레시피 아이디"), fieldWithPath("[].recipeTitle").description("레시피 제목"), + fieldWithPath("[].recipeThumbnail").description("레시피 썸네일"), fieldWithPath("[].createdAt").description("작성 시간"), fieldWithPath("[].message").description("내용") ))) diff --git a/backend/src/test/java/net/pengcook/comment/service/CommentServiceTest.java b/backend/src/test/java/net/pengcook/comment/service/CommentServiceTest.java index 799cd622..c700dd27 100644 --- a/backend/src/test/java/net/pengcook/comment/service/CommentServiceTest.java +++ b/backend/src/test/java/net/pengcook/comment/service/CommentServiceTest.java @@ -129,8 +129,8 @@ void deleteCommentsByUser() { void readCommentsOfUser() { UserInfo userInfo = new UserInfo(2, "loki@pengcook.net"); List expect = List.of( - new CommentOfUserResponse(1L, 1L, "김밥", LocalDateTime.of(2024, 1, 1, 0, 0, 0), "great"), - new CommentOfUserResponse(3L, 2L, "김치찌개", LocalDateTime.of(2024, 5, 5, 0, 0, 0), "good") + new CommentOfUserResponse(1L, 1L, "김밥", "김밥이미지.jpg", LocalDateTime.of(2024, 1, 1, 0, 0, 0), "great"), + new CommentOfUserResponse(3L, 2L, "김치찌개", "김치찌개이미지.jpg", LocalDateTime.of(2024, 5, 5, 0, 0, 0), "good") ); List actual = commentService.readCommentsOfUserV1(userInfo);