Delete post change logs before removing posts

This commit is contained in:
Tim
2025-09-17 13:30:58 +08:00
parent 9101ed336c
commit 5d499956d7
4 changed files with 8 additions and 0 deletions

View File

@@ -109,6 +109,10 @@ public class PostChangeLogService {
logRepository.save(log);
}
public void deleteLogsForPost(Post post) {
logRepository.deleteByPost(post);
}
public List<PostChangeLog> listLogs(Long postId) {
Post post = postRepository.findById(postId)
.orElseThrow(() -> new com.openisle.exception.NotFoundException("Post not found"));