From fd7b788baf8f6254d705e8b0fd3ed0905e4714db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=91=EC=88=98=ED=98=84=28=20Soo=20Hyun=20Yang=29?= <111266513+YangSooHyun0@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:48:39 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20SpaceWallTemporaryService=EC=9D=98?= =?UTF-8?q?=20delete=20=EB=A9=94=EC=84=9C=EB=93=9C=EB=A5=BC=20EntityManage?= =?UTF-8?q?r=EB=A5=BC=20=ED=99=9C=EC=9A=A9=ED=95=98=EC=97=AC=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81=20(#202)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javajober/spaceWall/repository/SpaceWallRepository.java | 2 -- .../spaceWall/service/SpaceWallTemporaryService.java | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/javajober/spaceWall/repository/SpaceWallRepository.java b/src/main/java/com/javajober/spaceWall/repository/SpaceWallRepository.java index 3ae4e67..6509065 100644 --- a/src/main/java/com/javajober/spaceWall/repository/SpaceWallRepository.java +++ b/src/main/java/com/javajober/spaceWall/repository/SpaceWallRepository.java @@ -13,8 +13,6 @@ public interface SpaceWallRepository extends Repository { - void deleteAll(List spaceWalls); - SpaceWall save(final SpaceWall spaceWall); boolean existsByShareURL(final String shareURL); diff --git a/src/main/java/com/javajober/spaceWall/service/SpaceWallTemporaryService.java b/src/main/java/com/javajober/spaceWall/service/SpaceWallTemporaryService.java index 2c58223..f85c7ef 100644 --- a/src/main/java/com/javajober/spaceWall/service/SpaceWallTemporaryService.java +++ b/src/main/java/com/javajober/spaceWall/service/SpaceWallTemporaryService.java @@ -14,9 +14,11 @@ public class SpaceWallTemporaryService { private final SpaceWallRepository spaceWallRepository; + private final EntityManager entityManager; - public SpaceWallTemporaryService(final SpaceWallRepository spaceWallRepository){ + public SpaceWallTemporaryService(final SpaceWallRepository spaceWallRepository, final EntityManager entityManager){ this.spaceWallRepository = spaceWallRepository; + this.entityManager = entityManager; } @Transactional @@ -26,7 +28,7 @@ public void delete(final Long memberId, final Long addSpaceId) { spaceWalls.removeIf(spaceWall -> !spaceWall.getFlag().equals(FlagType.PENDING)); - spaceWallRepository.deleteAll(spaceWalls); + spaceWalls.forEach(entityManager::remove); } public SpaceWallTemporaryResponse hasSpaceWallTemporary(final Long memberId, final Long addSpaceId) {