Skip to content

Commit

Permalink
#24 feat : 유저 탈퇴시, 관련된 board_user 엔티티 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhn committed Mar 24, 2023
1 parent c29776f commit 22064d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ public interface BoardUserRepository extends JpaRepository<BoardUser, Long> {

@Query("select bu from BoardUser bu where bu.status = 'ACTIVE' and bu.board.id = :boardId")
List<BoardUser> findAllByBoardId(@Param("boardId") Long boardId);

Void deleteAllByUserId(Long userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -217,6 +219,8 @@ public ApplicationResponse<Void> delUser(Long userId){
userImageRepository.deleteAllByUserId(user.getId());
// user_interest 엔티티 삭제
userInterestRepository.deleteAllByUserId(user.getId());
// board_user 엔티티 삭제
boardUserRepository.deleteAllByUserId(user.getId());

return ApplicationResponse.ok();
}
Expand Down

0 comments on commit 22064d1

Please sign in to comment.