From 4a3a59cdf88dc3dbfd732cc5444679f75ff1af4a Mon Sep 17 00:00:00 2001 From: gitjiho Date: Thu, 28 Nov 2024 00:35:27 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=A6=AC=ED=8C=A9=ED=84=B0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/software/ott/friend/repository/FriendRepository.java | 1 + .../java/com/software/ott/history/entity/ContentLike.java | 4 ---- .../com/software/ott/history/service/ContentLikeService.java | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/software/ott/friend/repository/FriendRepository.java b/src/main/java/com/software/ott/friend/repository/FriendRepository.java index 7ec2527..552bc3e 100644 --- a/src/main/java/com/software/ott/friend/repository/FriendRepository.java +++ b/src/main/java/com/software/ott/friend/repository/FriendRepository.java @@ -11,5 +11,6 @@ @Repository public interface FriendRepository extends JpaRepository { List findAllByAccepterIdAndStatusOrRequesterIdAndStatus(Long accepterId, FriendStatus status1, Long requesterId, FriendStatus status2); + boolean existsByRequesterAndAccepter(Member requester, Member accepter); } diff --git a/src/main/java/com/software/ott/history/entity/ContentLike.java b/src/main/java/com/software/ott/history/entity/ContentLike.java index 8370b00..36cb865 100644 --- a/src/main/java/com/software/ott/history/entity/ContentLike.java +++ b/src/main/java/com/software/ott/history/entity/ContentLike.java @@ -30,8 +30,4 @@ public class ContentLike { @JoinColumn(name = "content_id") @OnDelete(action = OnDeleteAction.CASCADE) private Content content; - - public boolean memberIsNotCorrect(Member member) { - return !this.member.equals(member); - } } diff --git a/src/main/java/com/software/ott/history/service/ContentLikeService.java b/src/main/java/com/software/ott/history/service/ContentLikeService.java index e557bd4..d0f8d15 100644 --- a/src/main/java/com/software/ott/history/service/ContentLikeService.java +++ b/src/main/java/com/software/ott/history/service/ContentLikeService.java @@ -77,7 +77,7 @@ public List getTop10MostLikedContents() { @Transactional public void deleteContentLike(Long memberId, Long contentId) { ContentLike contentLike = contentLikeRepository.findByMemberIdAndContentId(memberId, contentId) - .orElseThrow(() -> new BadRequestException("선호도를 삭제할 권한이 없습니다.")); + .orElseThrow(() -> new BadRequestException("선호도를 삭제할 권한이 없습니다.")); contentLikeRepository.delete(contentLike); }