Skip to content

Commit

Permalink
refactor: SpaceWallTemporaryService의 delete 메서드를 EntityManager를 활용하여 …
Browse files Browse the repository at this point in the history
…리팩토링 (#202)
  • Loading branch information
YangSooHyun0 authored Oct 25, 2023
1 parent 05b84b3 commit fd7b788
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

public interface SpaceWallRepository extends Repository<SpaceWall, Long> {

void deleteAll(List<SpaceWall> spaceWalls);

SpaceWall save(final SpaceWall spaceWall);

boolean existsByShareURL(final String shareURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit fd7b788

Please sign in to comment.