From be9bf411787602b280acd74ee55baa4e4c95f222 Mon Sep 17 00:00:00 2001 From: Sangyoo Date: Mon, 30 Jan 2023 21:04:00 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20post=20delete=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20#78?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attraction/service/AttractionService.java | 2 -- .../domain/post/controller/PostController.java | 5 +++-- .../global/batch/RankingCalcConfiguration.java | 14 ++++++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/server/src/main/java/com/main36/pikcha/domain/attraction/service/AttractionService.java b/server/src/main/java/com/main36/pikcha/domain/attraction/service/AttractionService.java index 72a60d60..2efa70df 100644 --- a/server/src/main/java/com/main36/pikcha/domain/attraction/service/AttractionService.java +++ b/server/src/main/java/com/main36/pikcha/domain/attraction/service/AttractionService.java @@ -2,7 +2,6 @@ import com.main36.pikcha.domain.attraction.entity.Attraction; import com.main36.pikcha.domain.attraction.repository.AttractionRepository; -import com.main36.pikcha.domain.image.service.AttractionImageService; import com.main36.pikcha.domain.like.entity.AttractionLikes; import com.main36.pikcha.domain.like.repository.AttractionLikesRepository; import com.main36.pikcha.domain.member.entity.Member; @@ -26,7 +25,6 @@ @RequiredArgsConstructor public class AttractionService { private final AttractionRepository attractionRepository; - private final AttractionImageService attractionImageService; private final AttractionLikesRepository attractionLikesRepository; private final SaveRepository saveRepository; diff --git a/server/src/main/java/com/main36/pikcha/domain/post/controller/PostController.java b/server/src/main/java/com/main36/pikcha/domain/post/controller/PostController.java index 51e6f383..771ff2b2 100644 --- a/server/src/main/java/com/main36/pikcha/domain/post/controller/PostController.java +++ b/server/src/main/java/com/main36/pikcha/domain/post/controller/PostController.java @@ -33,7 +33,6 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletRequest; import javax.validation.constraints.Positive; import java.io.IOException; @@ -267,7 +266,9 @@ public ResponseEntity deletePost(Member loginUser, String dirName = "images"; Post post = verifiedById(loginUser.getMemberId(), postId); // CascadeType.REMOVE 라서 객체는 지울 필요 없고, s3에서 이미지만 지우면 된다 - postImageService.deleteOnlyS3Images(post.getPostImages()); + if(!post.getPostImages().isEmpty()){ + postImageService.deleteOnlyS3Images(post.getPostImages()); + } postService.erasePost(post); diff --git a/server/src/main/java/com/main36/pikcha/global/batch/RankingCalcConfiguration.java b/server/src/main/java/com/main36/pikcha/global/batch/RankingCalcConfiguration.java index a7c2983d..ac0d1e67 100644 --- a/server/src/main/java/com/main36/pikcha/global/batch/RankingCalcConfiguration.java +++ b/server/src/main/java/com/main36/pikcha/global/batch/RankingCalcConfiguration.java @@ -1,3 +1,4 @@ +/* package com.main36.pikcha.global.batch; import com.main36.pikcha.domain.attraction.entity.Attraction; @@ -86,11 +87,14 @@ public ItemWriter writer(@Value("#{jobParameters[date]}") String da return new JpaItemWriterBuilder() .entityManagerFactory(entityManagerFactory) .build(); - /*return new JdbcBatchItemWriterBuilder() + */ +/*return new JdbcBatchItemWriterBuilder() .dataSource(dataSource) - .sql("insert into attraction(rank, rankChange")*/ + .sql("insert into attraction(rank, rankChange")*//* + } - /*@Bean + */ +/*@Bean @StepScope public Step simpleStep2(@Value("#{jobParameters[requestDate]}")String requestDate){ return stepBuilderFactory.get("simpleJob") @@ -100,5 +104,7 @@ public Step simpleStep2(@Value("#{jobParameters[requestDate]}")String requestDat return RepeatStatus.FINISHED; })) .build(); - }*/ + }*//* + } +*/