Skip to content

Commit

Permalink
refactor: 일치 여부 판단 메서드 중복 제거 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdohyung committed Mar 26, 2024
1 parent 760f3c7 commit dbf939f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void deleteReview(Long reviewId, Long userId) {
User user = userRepository.findById(userId)
.orElseThrow(() -> new BusinessException(USER_NOT_FOUND));

if (!user.isSame(reviewUser.getId())) {
if (!user.isMe(reviewUser.getId())) {
throw new BusinessException(UNAUTHORIZED_REQUEST);
}
reviewRepository.delete(deleteReview);
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/jisungin/domain/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,4 @@ public boolean isMe(Long userId) {
return this.id.equals(userId);
}

public boolean isSame(Long userId) {
return this.id.equals(userId);
}

}

0 comments on commit dbf939f

Please sign in to comment.