diff --git a/src/main/java/com/sparksInTheStep/webBoard/comment/application/CommentService.java b/src/main/java/com/sparksInTheStep/webBoard/comment/application/CommentService.java index c587b52..76001be 100644 --- a/src/main/java/com/sparksInTheStep/webBoard/comment/application/CommentService.java +++ b/src/main/java/com/sparksInTheStep/webBoard/comment/application/CommentService.java @@ -26,17 +26,12 @@ public class CommentService { @Transactional(readOnly = true) public Page readCommentsByPostId(Long postId, Pageable pageable){ - if(isExistId(postId)){ + if(postRepository.existsById(postId)){ return commentRepository.findAllByPostId(postId, pageable).map(CommentInfo::from); } throw CustomException.of(PostErrorCode.NOT_FOUND); } - @Transactional(readOnly = true) - protected boolean isExistId(Long id){ - return commentRepository.existsById(id); - } - @Transactional public void makeNewComment(CommentCommand commentCommand, String nickname){ commentRepository.save(Comment.of(