Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/213] 즐겨찾기 설정/해제 API 탈퇴여부 검증 추가 #214

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading