Skip to content

Commit

Permalink
Merge pull request #61 from BaeJunH0/hotfix/wtfWhyIWriteCodeLikeThis
Browse files Browse the repository at this point in the history
fix : ?? 왜 이렇게 짰음?
  • Loading branch information
BaeJunH0 authored Nov 30, 2024
2 parents 2a3e430 + e63035b commit 8604c1d
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,12 @@ public class CommentService {

@Transactional(readOnly = true)
public Page<CommentInfo> 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(
Expand Down

0 comments on commit 8604c1d

Please sign in to comment.