Skip to content

Commit

Permalink
✨ [Feat] 즐겨찾기 설정/해제 API 탈퇴여부 검증 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjin3395 committed Sep 8, 2024
1 parent 8b819c1 commit ae86894
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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", "해당 알림 타입 데이터를 찾을 수 없습니다."),
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/gamegoo/service/member/FriendService.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ public Friend starFriend(Long memberId, Long friendMemberId) {
Optional<Friend> 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);
Expand Down Expand Up @@ -316,6 +321,11 @@ public Friend unstarFriend(Long memberId, Long friendMemberId) {
Optional<Friend> 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);
Expand Down

0 comments on commit ae86894

Please sign in to comment.