From 3f6390d3349bcfc7c928fe4e082988b2d0b1c6c6 Mon Sep 17 00:00:00 2001 From: sycuuui <102959791+sycuuui@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:43:06 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20planReview=20condition=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Together/domain/plan/repository/PlanReviewRepository.java | 2 +- .../Journey/Together/domain/plan/service/PlanService.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/Journey/Together/domain/plan/repository/PlanReviewRepository.java b/src/main/java/Journey/Together/domain/plan/repository/PlanReviewRepository.java index 17025d8..f19ca3d 100644 --- a/src/main/java/Journey/Together/domain/plan/repository/PlanReviewRepository.java +++ b/src/main/java/Journey/Together/domain/plan/repository/PlanReviewRepository.java @@ -9,7 +9,7 @@ public interface PlanReviewRepository extends JpaRepository { - boolean existsAllByPlan(Plan plan); + boolean existsAllByPlanAndDeletedAtIsNull(Plan plan); @Query("SELECT EXISTS (" + "SELECT 1 FROM PlanReview pr " + "WHERE pr.plan = :plan AND (pr.report IS NULL OR pr.report = false))") diff --git a/src/main/java/Journey/Together/domain/plan/service/PlanService.java b/src/main/java/Journey/Together/domain/plan/service/PlanService.java index d96dfd6..7c4a214 100644 --- a/src/main/java/Journey/Together/domain/plan/service/PlanService.java +++ b/src/main/java/Journey/Together/domain/plan/service/PlanService.java @@ -184,7 +184,7 @@ public void savePlanReview(Member member, Long planId, PlanReviewReq planReviewR if(plan == null){ throw new ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION); } - if(planReviewRepository.existsAllByPlan(plan)){ + if(planReviewRepository.existsAllByPlanAndDeletedAtIsNull(plan)){ throw new ApplicationException(ErrorCode.ALREADY_EXIST_EXCEPTION); } //Business @@ -317,7 +317,7 @@ public List findMyPlans(Member member) { String remainDate = null; Boolean hasReview = null; if (LocalDate.now().isAfter(plan.getEndDate())){ - hasReview = planReviewRepository.existsAllByPlanAndReportFilter(plan); + hasReview = planReviewRepository.existsAllByPlanAndDeletedAtIsNull(plan); }else if ((LocalDate.now().isEqual(plan.getStartDate()) || LocalDate.now().isAfter(plan.getStartDate())) && (LocalDate.now().isEqual(plan.getEndDate()) || LocalDate.now().isBefore(plan.getEndDate()))){ remainDate="D-DAY"; }else if (LocalDate.now().isBefore(plan.getStartDate())){