Skip to content

Commit

Permalink
style: 메서드 및 필드 순서 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
le2sky committed Jan 24, 2025
1 parent a91934b commit d3ab296
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
@RequiredArgsConstructor
public class CommentService {

private final CommentRepository commentRepository;
private final MemberRepository memberRepository;
private final CommentRepository commentRepository;
private final CommentLikeRepository commentLikeRepository;

private final Map<String, Member> transactionTmpMemberMap = new ConcurrentHashMap<>();
Expand Down
14 changes: 7 additions & 7 deletions maeil-wiki/src/main/java/maeilwiki/wiki/WikiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ public void remove(Long wikiId) {
wiki.remove();
}

private void validateHasComment(Long wikiId) {
boolean hasComment = commentRepository.existsByWikiIdAndDeletedAtIsNull(wikiId);
if (hasComment) {
throw new IllegalStateException("답변이 존재하는 위키는 삭제할 수 없습니다.");
}
}

@Transactional
public void comment(CommentRequest request, Long wikiId) {
Wiki wiki = wikiRepository.findByIdAndDeletedAtIsNull(wikiId)
.orElseThrow(NoSuchElementException::new);

commentService.comment(request, wiki.getId());
}

private void validateHasComment(Long wikiId) {
boolean hasComment = commentRepository.existsByWikiIdAndDeletedAtIsNull(wikiId);
if (hasComment) {
throw new IllegalStateException("답변이 존재하는 위키는 삭제할 수 없습니다.");
}
}
}

0 comments on commit d3ab296

Please sign in to comment.