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

[COZY-432] feat: 사용자가 방에 들어가면 다른 요청들 날리기 #209

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

suuu0719
Copy link
Contributor

@suuu0719 suuu0719 commented Dec 3, 2024

⚒️develop의 최신 커밋을 pull 받았나요?

#️⃣ 작업 내용

어떤 방에 들어가는 순간 기존 초대 및 참여 요청을 자동으로 날립니다

동작 확인

image
memberId 99 → 여러방(57,72,37)에 INVITED, PENDING 상태

방장에게 보이는 참여요청 리스트
image

99번 참여 요청 수락함
image
image
37번 JOINED 룸 제외하고 모든 요청 지워짐
image
98번 요청을 거절했을때는 안날라감
image

💬 리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
고민사항도 적어주세요.

@suuu0719 suuu0719 added the enhancement New feature or request label Dec 3, 2024
@suuu0719 suuu0719 self-assigned this Dec 3, 2024
Copy link

github-actions bot commented Dec 3, 2024

리뷰해드려요~

MateRepository.java

  • 삭제 : countActiveMatesByRoomId, countByRoomId, deleteByRoomIdAndMemberId, findByMemberIdAndEntryStatus, findAllByMemberIdAndEntryStatus, findByRoom, deleteAllByMemberIdAndEntryStatusIn 메소드
  • 추가 : deleteAllByMemberIdAndEntryStatusIn 메소드

RoomCommandService.java

  • 수정 : joinRoom, sendInvitation, respondToInvitation, respondToJoinRequest 메소드
  • 삭제 : processJoinRequest, clearOtherRoomRequests 메소드

RoomQueryService.java

  • 수정 : getExistRoom, getInvitedMemberList, getPendingMemberList, getRequestedRoomList, getInvitedRoomList 메소드

  • 추가 : getRoomList 메소드

  • 제안 :

  1. RoomCommandService.java 내 processJoinRequest 메소드를 삭제하고, 해당 메소드 내용을 joinRoom, sendInvitation, respondToInvitation, respondToJoinRequest 메소드에 삽입하였으나, 이렇게 하면 메소드 내용이 복잡해질 수 있으므로 다시 구현하여 메소드 내용을 간결하게 유지하는 것이 좋을 것 같습니다.
  2. RoomQueryService.java 내 getRoomList 메소드는 현재 getExistRoom, getInvitedMemberList, getPendingMemberList, getRequestedRoomList, getInvitedRoomList 메소드에서 반복되는 코드가 존재하는 것 같습니다. 이를 줄여 코드를 간결하게 유지하는 것이 좋을 것 같습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안쓰는것들 지운거라 무시하셔도 됩니다

Comment on lines +138 to +139
if (room.getNumOfArrival() >= room.getMaxMateNum()) {
throw new GeneralException(ErrorStatus._ROOM_FULL); // 방이 가득 찼을 경우 예외 처리
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

방 정원 검사를 중구난방으로 하고 있어서 통일했습니다 (무시해도 됨)

room.arrive();
room.isRoomFull();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

방 참여시 JOINED STATE로 업데이트

room.arrive();
room.isRoomFull();
roomRepository.save(room);
processJoinRequest(existingMate.get(), room);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

재입장하는 경우(status가 EXITED)에 대해 processJoinRequest를 호출합니다

room.isRoomFull();
roomRepository.save(room);
processJoinRequest(existingMate.get(), room);
clearOtherRoomRequests(memberId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JOINED됐으면 기존 요청들을 날립니다

Comment on lines +368 to +369
processJoinRequest(invitee, room);
clearOtherRoomRequests(inviteeId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위랑 동일

Comment on lines +630 to +635
private void clearOtherRoomRequests(Long memberId) {
mateRepository.deleteAllByMemberIdAndEntryStatusIn(
memberId, List.of(EntryStatus.PENDING, EntryStatus.INVITED)
);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PENDING, INVITED 상태인 mate를 모두 삭제합니다

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이부분은 중복되는 코드 묶은거라 무시하셔도 됩니다

Copy link

github-actions bot commented Dec 4, 2024

리뷰해드려요~

MateRepository.java

  • 삭제된 메서드 : countActiveMatesByRoomId, countByRoomId, findByRoom
  • 추가된 메서드 : deleteAllByMemberIdAndEntryStatusIn

RoomCommandService.java

  • 수정된 메서드 : joinRoom, sendInvitation, respondToInvitation, respondToJoinRequest
  • 추가된 메서드 : processJoinRequest, clearOtherRoomRequests

RoomQueryService.java

  • 수정된 메서드 : getExistRoom, getInvitedMemberList, getPendingMemberList
  • 삭제된 메서드 : getInvitedRoomList
  • 추가된 메서드 : getRoomList

추가적으로 제안하고 싶은 점은 없습니다.

Copy link
Contributor

@genius00hwan genius00hwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 훨씬 로직이 깔끔해진것 같습니다!!

Copy link
Member

@eple0329 eple0329 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jpark0506 jpark0506 merged commit b49a851 into develop Dec 5, 2024
1 check passed
@jpark0506 jpark0506 deleted the feature/COZY-432 branch December 5, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants