From ae8689429a43dca22a8a304716577e083d1d12d0 Mon Sep 17 00:00:00 2001 From: Eunjin3395 Date: Mon, 9 Sep 2024 01:48:59 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20[Feat]=20=EC=A6=90=EA=B2=A8?= =?UTF-8?q?=EC=B0=BE=EA=B8=B0=20=EC=84=A4=EC=A0=95/=ED=95=B4=EC=A0=9C=20AP?= =?UTF-8?q?I=20=ED=83=88=ED=87=B4=EC=97=AC=EB=B6=80=20=EA=B2=80=EC=A6=9D?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gamegoo/apiPayload/code/status/ErrorStatus.java | 1 + .../java/com/gamegoo/service/member/FriendService.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/com/gamegoo/apiPayload/code/status/ErrorStatus.java b/src/main/java/com/gamegoo/apiPayload/code/status/ErrorStatus.java index 98ca52c0..aa2bb44c 100644 --- a/src/main/java/com/gamegoo/apiPayload/code/status/ErrorStatus.java +++ b/src/main/java/com/gamegoo/apiPayload/code/status/ErrorStatus.java @@ -158,6 +158,7 @@ public enum ErrorStatus implements BaseErrorCode { NOT_STAR_FRIEND(HttpStatus.BAD_REQUEST, "FRIEND410", "즐겨찾기 되어 있는 친구가 아닙니다."), FRIEND_SEARCH_QUERY_BAD_REQUEST(HttpStatus.BAD_REQUEST, "FRIEND411", "친구 검색 쿼리는 100자 이하여야 합니다."), + FRIEND_USER_DEACTIVATED(HttpStatus.NOT_FOUND, "FRIEND412", "친구 회원이 탈퇴했습니다."), // 알림 관련 에러 NOTIFICATION_TYPE_NOT_FOUND(HttpStatus.NOT_FOUND, "NOTI401", "해당 알림 타입 데이터를 찾을 수 없습니다."), diff --git a/src/main/java/com/gamegoo/service/member/FriendService.java b/src/main/java/com/gamegoo/service/member/FriendService.java index 822556dc..fcba4435 100644 --- a/src/main/java/com/gamegoo/service/member/FriendService.java +++ b/src/main/java/com/gamegoo/service/member/FriendService.java @@ -282,6 +282,11 @@ public Friend starFriend(Long memberId, Long friendMemberId) { Optional friend = friendRepository.findByFromMemberAndToMember(member, friendMember); + // 친구 회원의 탈퇴 여부 검증 + if (friendMember.getBlind()) { + throw new FriendHandler(ErrorStatus.FRIEND_USER_DEACTIVATED); + } + // 두 회원이 친구 관계가 맞는지 검증 if (friend.isEmpty()) { throw new FriendHandler(ErrorStatus.MEMBERS_NOT_FRIEND); @@ -316,6 +321,11 @@ public Friend unstarFriend(Long memberId, Long friendMemberId) { Optional friend = friendRepository.findByFromMemberAndToMember(member, friendMember); + // 친구 회원의 탈퇴 여부 검증 + if (friendMember.getBlind()) { + throw new FriendHandler(ErrorStatus.FRIEND_USER_DEACTIVATED); + } + // 두 회원이 친구 관계가 맞는지 검증 if (friend.isEmpty()) { throw new FriendHandler(ErrorStatus.MEMBERS_NOT_FRIEND);