From 113b6c465e467c6d2530d64daa995dcea63a7230 Mon Sep 17 00:00:00 2001 From: Hanvp Date: Mon, 23 Oct 2023 00:43:11 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20Feature/235=20comment=20=EA=B0=9C?= =?UTF-8?q?=EC=88=98=EC=97=90=20=EC=B0=A8=EB=8B=A8=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/zipdabang/server/converter/RecipeConverter.java | 8 ++++---- src/main/java/zipdabang/server/service/RecipeService.java | 2 ++ .../server/service/serviceImpl/RecipeServiceImpl.java | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/zipdabang/server/converter/RecipeConverter.java b/src/main/java/zipdabang/server/converter/RecipeConverter.java index ad7afbe..e5e5ef1 100644 --- a/src/main/java/zipdabang/server/converter/RecipeConverter.java +++ b/src/main/java/zipdabang/server/converter/RecipeConverter.java @@ -70,7 +70,7 @@ public static RecipeResponseDto.RecipePreviewDto toRecipePreviewDto(Recipe recip .recipeName(recipe.getName()) .nickname(recipe.getMember().getNickname()) .likes(recipe.getTotalLike()) - .comments(recipe.getTotalComments()) + .comments(staticRecipeService.getCommentCount(recipe,member)) .isLiked(staticRecipeService.checkIsLiked(recipe, member)) .isScrapped(staticRecipeService.checkIsScrapped(recipe,member)) .isBlocked(staticRecipeService.checkOwnerBlocked(recipe,member)) @@ -176,7 +176,7 @@ private static RecipeResponseDto.RecipeSimpleDtoBest toResponseWeekBestDto(Recip .createdAt(staticTimeConverter.ConvertTime(recipe.getCreatedAt())) .updatedAt(staticTimeConverter.ConvertTime(recipe.getUpdatedAt())) .likes(recipe.getTotalLike()) - .comments(recipe.getTotalComments()) + .comments(staticRecipeService.getCommentCount(recipe,member)) .scraps(recipe.getTotalScrap()) .isLiked(staticRecipeService.checkIsLiked(recipe,member)) .isScrapped(staticRecipeService.checkIsScrapped(recipe,member)) @@ -223,7 +223,7 @@ private static RecipeResponseDto.RecipeSimpleDto toResponseRecipeSimpleDto(Recip .thumbnailUrl(recipe.getThumbnailUrl()) .createdAt(staticTimeConverter.ConvertTime(recipe.getCreatedAt())) .updatedAt(staticTimeConverter.ConvertTime(recipe.getUpdatedAt())) - .comments(recipe.getTotalComments()) + .comments(staticRecipeService.getCommentCount(recipe,member)) .likes(recipe.getTotalLike()) .scraps(recipe.getTotalScrap()) .isLiked(staticRecipeService.checkIsLiked(recipe,member)) @@ -433,7 +433,7 @@ public static RecipeResponseDto.RecipeDto toResponseRecipeDto(Recipe recipe, Boo .createdAt(staticTimeConverter.ConvertTime(recipe.getCreatedAt())) .updatedAt(staticTimeConverter.ConvertTime(recipe.getUpdatedAt())) .likes(recipe.getTotalLike()) - .comments(Long.valueOf(recipe.getCommentList().size())) + .comments(staticRecipeService.getCommentCount(recipe,member)) .scraps(recipe.getTotalScrap()) .isLiked(isLiked) .isScrapped(isScrapped) diff --git a/src/main/java/zipdabang/server/service/RecipeService.java b/src/main/java/zipdabang/server/service/RecipeService.java index 0e87509..9d38c90 100644 --- a/src/main/java/zipdabang/server/service/RecipeService.java +++ b/src/main/java/zipdabang/server/service/RecipeService.java @@ -99,4 +99,6 @@ public interface RecipeService { Long getrecipeListByCategoryCounting(Long categoryId, Member member); Long getWrittenByRecipeCounting(String writtenby, Member member); + + Long getCommentCount(Recipe recipe, Member member); } diff --git a/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java b/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java index b577e19..ededb73 100644 --- a/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java +++ b/src/main/java/zipdabang/server/service/serviceImpl/RecipeServiceImpl.java @@ -786,6 +786,11 @@ else if (!findComment.getRecipe().equals(findRecipe)) } } + @Override + public Long getCommentCount(Recipe recipe, Member member) { + return commentRepositoryCustom.commentListTotalCount(member, recipe); + } + @Transactional(readOnly = false) @Override public Long reportComment(Long recipeId, Long commentId, Long reportId, Member member) {