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

[LIME-141] 채팅방 목록 조회, 채팅방 참여, 채팅방 인원수 조회, 채팅방 나가기 기능 구현 #70

Merged
merged 5 commits into from
Mar 23, 2024

Conversation

Curry4182
Copy link
Contributor

@Curry4182 Curry4182 commented Mar 18, 2024

📌 PR 종류

어떤 종류의 PR인지 아래 항목 중에 체크 해주세요.

  • 🐛 버그 수정
  • ✨ 기능 추가
  •  테스트 추가
  • 🎨 코드 스타일 변경 (formatting, local variables)
  • 🔨 리팩토링 (기능 변경 X)
  • 💚 빌드 관련 수정
  • 📝 문서 내용 수정
  • 그 외, 어떤 종류인지 기입 바람:

📌 어떤 기능이 추가 되었나요?

총 네 가지의 기능이 추가 되었습니다.

  • 채팅방 목록 조회(전체
  • 채팅방 참여
  • 채팅방 인원수 조회
  • 채팅방 나가기 기능

Issue Number

LIME-141

기능 설명

채팅방 목록 조회(전체)

  • 데이터 베이스에 있는 참여 가능한 전체 채팅방을 조회 합니다.
  • memberId가 있는 경우와 없는 경우를 나눠서 조회 합니다.
  • memberId가 있는 경우 chat_rooms과 chat_room_members 테이블과 left join 하여 입력으로 받은 memberId가 일치하는지 확인합니다. 이 때 일치하는 memberId가 chat_room_members에 있다면 isJoined를 true 반환하고 아니면 false로 반환 합니다.
  • memberId가 없는 경우 위 작업을 생략하고 isJoined를 false로 반환 합니다.
  • 채팅방 목록 조회 요구사항이 복잡해서 Querydsl로 구현 하였습니다.

채팅방 참여

  • room id는 path variable로 받고 token은 헤더에서 가져와 처리합니다.
  • jpa repository의 save 메서드를 사용하여 저장합니다ㅏ.

채팅방 인원수 조회

  • room id를 입력받아 chat_rooom_members 테이블을 조회하여 일치하는 room id의 개수를 반환 합니다.

채팅방 나가기

  • room id는 path variable로 받고 token은 헤더에서 가져와 처리합니다.
  • chat_room_members 테이블에 room id와 일치하는 row를 삭제합니다.

📌 기존에 있던 기능에 영향을 주나요?

  • 아니요

@Curry4182 Curry4182 self-assigned this Mar 18, 2024
@Curry4182 Curry4182 added the enhancement New feature or request label Mar 18, 2024
Copy link
Member

@HandmadeCloud HandmadeCloud left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~ 채팅에 대해선 가능한 계속 공부해보고 싶네요 저도!


//private final ChatService chatService;

@Operation(summary = "채티방 전체 조회", description = "채팅방을 조회합니다.")
Copy link
Member

Choose a reason for hiding this comment

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

약간의 오타를 찾았습니다 ㅎ

Copy link
Contributor Author

@Curry4182 Curry4182 Mar 22, 2024

Choose a reason for hiding this comment

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

아! 이 부분은 다음 채팅 PR이 완료되면 넣기 위해 주석처리하여습니다.
따로 말씀 못드려서 혼동이 왔네요 죄송합니다.

Copy link
Member

Choose a reason for hiding this comment

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

주석 말고 스웨거 설명 말하시는 거 같아요 ㅎㅎ

Copy link
Contributor Author

@Curry4182 Curry4182 Mar 22, 2024

Choose a reason for hiding this comment

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

수정하였습니다! ㅎㅎ 2bcd9c6

Comment on lines +48 to +54
@Operation(summary = "채팅방 인원수 조회", description = "채팅방의 인원수를 조회합니다.")
@GetMapping("/{chatRoomId}/members/count")
public ResponseEntity<Integer> countChatRoomMembers(@PathVariable final Long chatRoomId) {
return ResponseEntity.ok(
chatRoomService.countChatRoomMembersByChatRoomId(chatRoomId)
);
}
Copy link
Member

Choose a reason for hiding this comment

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

인원수 조회하는 api가 따로 필요한 이유가 호기심으로 궁금해요

Copy link
Contributor Author

@Curry4182 Curry4182 Mar 22, 2024

Choose a reason for hiding this comment

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

처음 사용자가 채팅방을 선택할 때 인원이 몇명이 있는지 프론트에서 확인하기 위해 만들었습니다

Copy link
Member

@Yiseull Yiseull left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~! 몇 가지 리뷰 남겼어요!!


private final ChatRoomService chatRoomService;

//private final ChatService chatService;
Copy link
Member

Choose a reason for hiding this comment

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

P5;
ChatService는 사용하지 않는 건가요?? 그럼 삭제하는 게 어떨까요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이 부분은 다음 PR이 완료되면 다시 넣을 예정 입니다.

public record ChatRoomGetListResponse(
List<ChatRoomInfo> chatRoomInfos
) {
public static ChatRoomGetListResponse from(ChatRoomGetServiceListResponse chatRoomGetServiceListResponse) {
Copy link
Member

Choose a reason for hiding this comment

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

P1;
final 키워드 추가해주세여~

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
Contributor Author

Choose a reason for hiding this comment

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

추가하였습니다! 98cfbd5

Comment on lines 44 to 48
if(Objects.isNull(memberId)) {
chatRoomInfos = chatRoomReader.readOpenChatRooms();
} else {
chatRoomInfos = chatRoomReader.readOpenChatRoomsByMemberId(memberId);
}
Copy link
Member

Choose a reason for hiding this comment

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

P5; (궁금)
회원 아이디 유무에 따라서 조회하는 채팅방이 다른것 같은데 어떻게 다른건가요??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

memberId에 따라 구현 계층에서 호출하는 메서드가 달랐습니다.
null 확인은 구현계층에서 하도록 변경하였습니다. d675452

Copy link
Member

Choose a reason for hiding this comment

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

아! 제가 질문을 모호하게 했네요. 회원과 비회원이 들어갈 수 있는 채팅방이 따로 있는건가요?! 어떤 기능인지에 대한 질문입니당!

  • 이런 부분을 기능 명세서로 간단하게 작성해주시면 리뷰하는데 도움이 될 것 같습니다!

Copy link
Contributor Author

@Curry4182 Curry4182 Mar 22, 2024

Choose a reason for hiding this comment

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

회원 아이디 유무에 따라서 조회하는 채팅방이 다른것 같은데 어떻게 다른건가요??

  • 아닙니다!! 같은 채팅방을 조회 하는데 사용 됩니다.

회원과 비회원이 들어갈 수 있는 채팅방이 따로 있는건가요?! 

  • 회원과 비회원이 구분되어 있는 채팅방은 없습니다!

전체적으로 lime.domains.chatroom.repository.ChatRoomQueryDslImpl에 구현되어 있는 로직을 보셔야 할 거 같아요

);
}

public void joinChatRoom(Long chatRoomId) {
Copy link
Member

Choose a reason for hiding this comment

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

p1;
final 추가 해주세요~ 다른 곳에도 빠져있네요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

추가하였습니다! d3d1cfa

@Curry4182 Curry4182 merged commit ab7bcc1 into main Mar 23, 2024
@Curry4182 Curry4182 deleted the LIME-141-chatroom-feat branch April 6, 2024 03:36
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.

3 participants