mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-03-06 12:00:44 +08:00
fix post deletion cascade
This commit is contained in:
@@ -41,4 +41,9 @@ public class PostReadService {
|
||||
.orElseThrow(() -> new IllegalArgumentException("User not found"));
|
||||
return postReadRepository.countByUser(user);
|
||||
}
|
||||
|
||||
@org.springframework.transaction.annotation.Transactional
|
||||
public void deleteByPost(Post post) {
|
||||
postReadRepository.deleteByPost(post);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,6 +360,7 @@ public class PostService {
|
||||
reactionRepository.findByPost(post).forEach(reactionRepository::delete);
|
||||
postSubscriptionRepository.findByPost(post).forEach(postSubscriptionRepository::delete);
|
||||
notificationRepository.deleteAll(notificationRepository.findByPost(post));
|
||||
postReadService.deleteByPost(post);
|
||||
postRepository.delete(post);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user