diff --git a/server/src/main/java/com/yogit/server/board/repository/BoardUserRepository.java b/server/src/main/java/com/yogit/server/board/repository/BoardUserRepository.java index 6864497..875b98a 100644 --- a/server/src/main/java/com/yogit/server/board/repository/BoardUserRepository.java +++ b/server/src/main/java/com/yogit/server/board/repository/BoardUserRepository.java @@ -24,4 +24,6 @@ public interface BoardUserRepository extends JpaRepository { @Query("select bu from BoardUser bu where bu.status = 'ACTIVE' and bu.board.id = :boardId") List findAllByBoardId(@Param("boardId") Long boardId); + + Void deleteAllByUserId(Long userId); } diff --git a/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java b/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java index eaa1a7c..0a1d12b 100644 --- a/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java +++ b/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java @@ -3,6 +3,7 @@ import com.yogit.server.applelogin.exception.InvalidRefreshTokenException; import com.yogit.server.applelogin.exception.NotFoundRefreshTokenException; import com.yogit.server.block.service.BlockService; +import com.yogit.server.board.repository.BoardUserRepository; import com.yogit.server.config.domain.BaseStatus; import com.yogit.server.global.dto.ApplicationResponse; import com.yogit.server.global.service.TokenService; @@ -43,6 +44,7 @@ public class UserServiceImpl implements UserService { private final CityRepository cityRepository; private final InterestRepository interestRepository; private final UserInterestRepository userInterestRepository; + private final BoardUserRepository boardUserRepository; private final AwsS3Service awsS3Service; private final BlockService blockService; private final TokenService tokenService; @@ -217,6 +219,8 @@ public ApplicationResponse delUser(Long userId){ userImageRepository.deleteAllByUserId(user.getId()); // user_interest 엔티티 삭제 userInterestRepository.deleteAllByUserId(user.getId()); + // board_user 엔티티 삭제 + boardUserRepository.deleteAllByUserId(user.getId()); return ApplicationResponse.ok(); }