Skip to content

Commit

Permalink
Merge pull request #55 from AI-SIP/develop
Browse files Browse the repository at this point in the history
Bug Fix : Problem 엔티티 삭제 시 ProblemRepeats 객체도 함께 삭제하도록 수정
  • Loading branch information
KiSeungMin authored Oct 6, 2024
2 parents 2276ca6 + cc7872c commit 0d890c8
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ public void deleteProblem(Long userId, Long problemId) {
List<ImageData> images = fileUploadService.getProblemImages(problemId);
images.forEach(fileUploadService::deleteImage);

List<ProblemRepeat> problemRepeats = getProblemRepeats(problemId);
problemRepeatRepository.deleteAll(problemRepeats);

problemRepository.delete(problem);
} else {
throw new UserNotAuthorizedException("문제 작성자와 유저가 불일치합니다!");
Expand All @@ -310,6 +313,9 @@ public void deleteUserProblems(Long userId) {
Long problemId = problem.getId();
List<ImageData> images = fileUploadService.getProblemImages(problemId);
images.forEach(fileUploadService::deleteImage);

List<ProblemRepeat> problemRepeats = getProblemRepeats(problemId);
problemRepeatRepository.deleteAll(problemRepeats);
problemRepository.delete(problem);
});
}
Expand Down

0 comments on commit 0d890c8

Please sign in to comment.