diff --git a/lime-domain/src/main/java/com/programmers/lime/domains/review/implementation/ReviewLikeReader.java b/lime-domain/src/main/java/com/programmers/lime/domains/review/implementation/ReviewLikeReader.java index 05f6acc98..aab87e781 100644 --- a/lime-domain/src/main/java/com/programmers/lime/domains/review/implementation/ReviewLikeReader.java +++ b/lime-domain/src/main/java/com/programmers/lime/domains/review/implementation/ReviewLikeReader.java @@ -18,10 +18,6 @@ public boolean alreadyLiked( final Long memberId, final Long reviewId ) { - if (memberId == null) { - return false; - } - return reviewLikeRepository.existsByMemberIdAndReviewId(memberId, reviewId); } } diff --git a/lime-domain/src/main/java/com/programmers/lime/domains/review/implementation/ReviewLikeValidator.java b/lime-domain/src/main/java/com/programmers/lime/domains/review/implementation/ReviewLikeValidator.java index 49f66b4ad..ecde6ce21 100644 --- a/lime-domain/src/main/java/com/programmers/lime/domains/review/implementation/ReviewLikeValidator.java +++ b/lime-domain/src/main/java/com/programmers/lime/domains/review/implementation/ReviewLikeValidator.java @@ -17,6 +17,10 @@ public void validateReviewLike( final Long memberId, final Long reviewId ) { + if (memberId == null) { + throw new BusinessException(ErrorCode.MEMBER_ANONYMOUS); + } + if (reviewLikeReader.alreadyLiked(memberId, reviewId)) { throw new BusinessException(ErrorCode.ALREADY_REVIEW_LIKED); }