Skip to content

Conversation

@nayonsoso
Copy link
Collaborator

@nayonsoso nayonsoso commented Aug 17, 2025

관련 이슈

작업 내용

멘티의 멘토링 목록 조회 페이지에서, "멘토링 시작하기"를 누르면 해당 채팅방으로 이동합니다.
이 과정에서 API 호출을 줄이기 위해, 멘티의 멘토링 목록 조회 시 채팅방 ID를 함께 내려주도록 합니다.

image

특이 사항

https://github.com/solid-connection/api-docs/pull/46

리뷰 요구사항 (선택)

@coderabbitai
Copy link

coderabbitai bot commented Aug 17, 2025

Walkthrough

  1. ChatRoomRepository에 mentoringId 리스트로 조회하는 findAllByMentoringIdIn(List mentoringIds) 메서드가 추가되었습니다.
  2. MentoringForMentorResponse 레코드의 boolean isConfirmed가 VerifyStatus verifyStatus로 교체되었습니다.
  3. MentoringForMenteeResponse 레코드에 Long chatRoomId 필드가 추가되고, static of(Mentoring, SiteUser, Long) 팩토리 메서드로 시그니처가 변경되었습니다.
  4. MentoringQueryService가 ChatRoomRepository 의존성을 추가하고, 배치로 멘토링ID→채팅방ID 맵을 조회해 응답에 chatRoomId를 주입하도록 로직이 추가되었으며, 생성자 시그니처가 변경되었습니다.
  5. 테스트용 픽스처(ChatRoomFixture, ChatRoomFixtureBuilder)와 서비스 테스트(MentoringQueryServiceTest)가 멘토링별 채팅방 생성 및 chatRoomId 검증을 하도록 업데이트되었습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • Gyuhyeok99
  • wibaek
  • lsy1307

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6bed161 and 7c81da2.

📒 Files selected for processing (1)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nayonsoso nayonsoso changed the title refactor: 멘티의 멘토링 목록 조회 시 연관된 채팅방 ID 포함하여 응답하도록 refactor: 멘티의 멘토링 목록 조회 시 연관된 채팅방 ID를 함께 응답하도록 Aug 17, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (6)
src/main/java/com/example/solidconnection/chat/repository/ChatRoomRepository.java (1)

39-39: 배치 조회 메서드 범위/시그니처를 한 번에 다듬어 주세요.

    1. isGroup=false 조건을 메서드명으로 고정하면, 그룹 채팅방이 섞이는 실수를 원천 차단할 수 있습니다.
    • Mentoring 기반의 이동 목적이라면 1:1 방으로 한정되는 게 자연스럽습니다.
    1. 파라미터 타입을 Collection으로 넓히면 호출부 유연성(중복 제거된 Set 사용 등)이 올라갑니다.
    • 빈 컬렉션 입력 시 JPA 구현체에 따라 IN () 구문 문제를 유발할 수 있으니, 서비스 레이어에서 빈 입력을 조기 반환하도록 가드도 함께 고려해 주세요.
    1. 성능적으로 ChatRoom 엔티티 전체가 아닌 최소 컬럼(예: id, mentoringId)만 조회하는 프로젝션/커스텀 쿼리도 고려해 볼 만합니다.

아래처럼 메서드명을 구체화하고, 파라미터 타입을 Collection으로 변경하는 것을 제안드립니다.

-    List<ChatRoom> findAllByMentoringIdIn(List<Long> mentoringIds);
+    List<ChatRoom> findAllByMentoringIdInAndIsGroupFalse(Collection<Long> mentoringIds);

추가로, 대용량 조회 대비가 필요하다면 다음과 같은 간단한 프로젝션도 고려해 주세요.

public interface ChatRoomIdWithMentoringId {
    Long getId();
    Long getMentoringId();
}

@Query("select cr.id as id, cr.mentoringId as mentoringId from ChatRoom cr where cr.isGroup=false and cr.mentoringId in :mentoringIds")
List<ChatRoomIdWithMentoringId> findIdsByMentoringIdInAndIsGroupFalse(@Param("mentoringIds") Collection<Long> mentoringIds);
src/main/java/com/example/solidconnection/mentor/dto/MentoringForMentorResponse.java (1)

13-16: 필드 변경(verifyStatus 추가, isConfirmed 제거, chatRoomId 추가)에 따른 API 호환성 점검이 필요합니다.

    1. 기존 클라이언트가 isConfirmed를 참조했다면 바로 깨질 수 있으므로, 변경 공지/마이그레이션 가이드가 필요합니다.
    1. chatRoomId는 null 가능 Long으로 설계되어 합리적입니다. 다만 null 필드 노출 정책(예: Jackson @JsonInclude)을 팀 규칙에 맞춰 정리해 주세요.

원한다면 null 필드 미노출을 위해 아래와 같은 설정을 추가할 수 있습니다.

// 클래스 상단에
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_NULL)
public record MentoringForMentorResponse(...) { ... }
src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (1)

7-9: 멘토링 목록에 chatRoomId 포함 테스트 추가, 방향성 정확합니다. 다만 커버리지 보강을 제안드립니다.

    1. 현재 멘토 관점 테스트만 추가되어 있습니다. PR 요약(멘티 화면 API 호출 절감)에 맞춰 멘티 관점에서도 chatRoomId가 포함되는지 검증 테스트를 한 케이스 추가해 주세요.
    1. 동일 멘토링에 그룹/1:1 채팅방이 동시에 존재할 때 1:1만 선택되는지(또는 명시적 정책)도 테스트로 못박아 두면 회귀를 막을 수 있습니다.
    1. 빈 mentoringId 리스트일 때의 동작(조기 반환/쿼리 생략)도 서비스 레벨에서 가드되었는지 확인 부탁드립니다.

참고용 테스트 스케치입니다.

// 멘티 관점 chatRoomId 포함 테스트 (MentoringForMenteeResponse에 chatRoomId가 노출된다는 전제)
@Test
void 멘티_목록에서도_멘토링_채팅방_ID를_포함한다() {
    // given
    Mentoring mentoring = mentoringFixture.승인된_멘토링(mentor1.getId(), menteeUser1.getId());
    ChatRoom chatRoom = chatRoomFixture.멘토링_채팅방(mentoring.getId());

    // when
    SliceResponse<MentoringForMenteeResponse> response =
        mentoringQueryService.getMentoringsForMentee(menteeUser1.getId(), VerifyStatus.APPROVED, pageable);

    // then
    assertThat(response.content())
        .extracting(MentoringForMenteeResponse::mentoringId, MentoringForMenteeResponse::chatRoomId)
        .containsExactly(tuple(mentoring.getId(), chatRoom.getId()));
}

// 그룹/1:1 동시 존재 시 1:1만 선택되는지 확인 (레포지토리에서 isGroup=false 필터 전제)
@Test
void 동일_멘토링에_그룹과_일대일이_동시에_있어도_일대일_방_ID만_반환한다() {
    // given
    Mentoring mentoring = mentoringFixture.승인된_멘토링(mentor1.getId(), menteeUser1.getId());
    ChatRoom oneOnOne = chatRoomFixture.멘토링_채팅방(mentoring.getId());
    // 그룹 방 생성 (필요 시 별도 헬퍼 추가)
    ChatRoom group = chatRoomFixture.채팅방(true); // mentoringId=null 가정, 혹은 빌더로 mentoringId+isGroup(true) 생성

    // when
    SliceResponse<MentoringForMentorResponse> response =
        mentoringQueryService.getMentoringsForMentor(mentorUser1.getId(), pageable);

    // then
    assertThat(response.content())
        .filteredOn(r -> r.mentoringId() == mentoring.getId())
        .extracting(MentoringForMentorResponse::chatRoomId)
        .containsExactly(oneOnOne.getId());
}

Also applies to: 50-52, 129-147

src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java (3)

72-72: 멘토링ID→채팅방ID 배치 매핑 도입은 적절하지만, 빈 목록 최적화와 일관성 점검을 권장

  1. mentoringSlice가 비어있을 때도 repository가 호출될 수 있으니, 헬퍼에서 빈 목록이면 즉시 빈 Map을 반환하도록 방어 로직을 제안합니다.
  2. 같은 메서드 내에서 toList()와 getContent()를 혼용하고 있어 가독성이 떨어집니다. 하나로 통일하는 것을 권장합니다.

104-113: 중복 키와 빈 목록 방어 로직 추가 제안

  1. 데이터 무결성이 깨져 동일 멘토링에 다수 채팅방이 매핑될 경우, Collectors.toMap이 IllegalStateException을 던집니다. 병합 함수를 넣어 방어하세요.
  2. mentoringIds가 비어있는 경우, JPA의 IN () 처리 방식에 따라 불필요한 쿼리 또는 드라이버 에러 가능성이 있으므로 조기 반환을 권장합니다.

다음과 같이 보강하면 안전합니다.

     private Map<Long, Long> mapMentoringIdToChatRoomIdWithBatchQuery(List<Mentoring> mentorings) {
         List<Long> mentoringIds = mentorings.stream()
                 .map(Mentoring::getId)
                 .distinct()
                 .toList();
-        List<ChatRoom> chatRooms = chatRoomRepository.findAllByMentoringIdIn(mentoringIds);
-        return chatRooms.stream()
-                .collect(Collectors.toMap(ChatRoom::getMentoringId, ChatRoom::getId));
+        if (mentoringIds.isEmpty()) {
+            return Map.of();
+        }
+        List<ChatRoom> chatRooms = chatRoomRepository.findAllByMentoringIdIn(mentoringIds);
+        return chatRooms.stream()
+                .collect(Collectors.toMap(
+                        ChatRoom::getMentoringId,
+                        ChatRoom::getId,
+                        (first, duplicate) -> first // 중복 시 최초 항목 우선
+                ));
     }

72-72: PR 목표(이슈 #464)와의 정합성 확인: 멘티 응답에도 chatRoomId 포함되었나요?

  1. 본 서비스의 getMentoringsForMentee는 여전히 MentoringForMenteeResponse.of(mentoring, partner)만 호출하고 있어 chatRoomId 전달 흔적이 없습니다.
  2. 다른 계층/DTO에서 이미 반영했다면 괜찮지만, 미반영이라면 동일한 배치 매핑을 멘티 경로에도 적용해야 API 추가 호출을 제거할 수 있습니다.

예시 구현(참고용):

// getMentoringsForMentee 내
Map<Long, Long> mentoringIdToChatRoomId = mapMentoringIdToChatRoomIdWithBatchQuery(mentoringSlice.getContent());
List<MentoringForMenteeResponse> content = new ArrayList<>(mentoringSlice.getNumberOfElements());
for (Mentoring mentoring : mentoringSlice.getContent()) {
    content.add(MentoringForMenteeResponse.of(
        mentoring,
        mentoringToPartnerUser.get(mentoring),
        mentoringIdToChatRoomId.get(mentoring.getId()) // DTO가 chatRoomId 필드/팩토리 시그니처를 지원해야 합니다.
    ));
}

필요하시면 DTO/서비스/테스트까지 포함한 전체 패치를 준비해 드릴게요.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between afe27ab and 5616086.

📒 Files selected for processing (6)
  • src/main/java/com/example/solidconnection/chat/repository/ChatRoomRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMentorResponse.java (2 hunks)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java (4 hunks)
  • src/test/java/com/example/solidconnection/chat/fixture/ChatRoomFixture.java (1 hunks)
  • src/test/java/com/example/solidconnection/chat/fixture/ChatRoomFixtureBuilder.java (2 hunks)
  • src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (5)
src/main/java/com/example/solidconnection/mentor/dto/MentoringForMentorResponse.java (1)

18-27: 팩토리 메서드 시그니처 변경(of(..., Long chatRoomId))은 목적에 적합하며 매핑도 올바릅니다.

    1. verifyStatus는 mentoring.getVerifyStatus()로 정확히 채워지고,
    1. isChecked는 멘토 관점의 checkedAt을 사용해 일관적이며,
    1. createdAt과 chatRoomId 전달도 자연스럽습니다.

추가로, 멘티 측 응답에도 동일한 chatRoomId 포함 요건이 있다면 대응 DTO/팩토리 메서드도 동기화돼야 합니다. 현재 멘토용만 보이므로 멘티용 포함 여부를 한 번 확인 부탁드립니다.

src/test/java/com/example/solidconnection/chat/fixture/ChatRoomFixture.java (1)

19-24: 멘토링 전용(1:1) 채팅방 생성 헬퍼 추가, 좋아요.

    1. mentoringId 지정 + isGroup(false)를 고정해 테스트 가독성과 의도를 잘 드러냅니다.
    1. 추후 필요 시 생성 시각/참여자까지 확장하는 헬퍼도 쉽게 붙일 수 있겠습니다.
src/test/java/com/example/solidconnection/chat/fixture/ChatRoomFixtureBuilder.java (1)

26-33: 빌더에 mentoringId 체이닝과 생성자 연결이 자연스럽습니다.

    1. mentoringId(long) → Long 필드 설정이 명확하고,
    1. create()에서 new ChatRoom(mentoringId, isGroup) 매핑이 직관적입니다.

테스트에서 멘토링 연계/일반 채팅방 모두 만들 수 있게 유연하게 설계된 점이 좋습니다.

src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java (2)

5-6: 채팅방 연동을 위한 import 추가, 방향성 OK

  1. ChatRoom/ChatRoomRepository 의존성 추가가 배치 조회 설계와 잘 맞습니다.
  2. 도메인 타입(ChatRoom)도 아래 메서드에서 실제 사용되어 불필요 import 아님을 확인했습니다.

38-38: 생성자 주입으로 ChatRoomRepository 추가, 구성 타당

  1. RequiredArgsConstructor에 의해 안전하게 주입되고, 읽기 전용 쿼리 흐름과도 일관적입니다.
  2. 멘토링→채팅방 매핑 배치 조회 도입을 위한 필수 의존성으로 보입니다.

@nayonsoso nayonsoso force-pushed the refactor/464-include-chatroom-id branch from 5616086 to 6bed161 Compare August 17, 2025 17:12
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (2)

50-52: 2) ChatRoomFixture 주입 추가는 테스트 준비 단계를 깔끔하게 만듭니다.

  • 테스트 픽스처로 채팅방을 생성·관리하게 되어 가독성과 재사용성이 좋아졌습니다.

  • 제안 1. 필요 시 생성자 주입으로 전환하면 불변성을 유지하면서 의존성 명시성이 더 좋아집니다.

  • 제안 2. 픽스처 내부에서 테스트 간 데이터 정리가 이뤄지는지 확인해 주세요. 테스트 컨테이너/롤백 전략과 맞물려 데이터 간섭이 없으면 충분합니다.


154-171: 테스트 보강 및 ChatRoom 중복 생성 방어 로직 확인 요청

  1. 미존재 채팅방 케이스 테스트 추가

    • 승인된 멘토링에 아직 채팅방이 생성되지 않은 경우에도 chatRoomIdnull로 안전하게 반환되는지 검증하는 테스트를 보강하세요.
    • 예시:
      @Test
      void 채팅방이_없는_승인된_멘토링은_chatRoomId가_null이다() {
          // given
          Mentoring mentoring1 = mentoringFixture.승인된_멘토링(mentor1.getId(), menteeUser1.getId());
          Mentoring mentoring2 = mentoringFixture.승인된_멘토링(mentor2.getId(), menteeUser1.getId());
          // mentoring1에 대해서만 채팅방 생성
          ChatRoom mentoringChatRoom1 = chatRoomFixture.멘토링_채팅방(mentoring1.getId());
      
          // when
          SliceResponse<MentoringForMenteeResponse> response =
              mentoringQueryService.getMentoringsForMentee(
                  menteeUser1.getId(), VerifyStatus.APPROVED, pageable);
      
          // then
          assertThat(response.content())
              .extracting(MentoringForMenteeResponse::mentoringId, MentoringForMenteeResponse::chatRoomId)
              .containsExactlyInAnyOrder(
                  tuple(mentoring1.getId(), mentoringChatRoom1.getId()),
                  tuple(mentoring2.getId(),     null)
              );
      }
  2. 멘토링‒채팅방 매핑 유니크 제약 및 방어 로직 검토

    • 현재 ChatRoom 엔티티에는 mentoringId에 대한 DB-level unique 제약이 없습니다.
    • 서비스 레이어에서는 chatRoomRepository.findAllByMentoringIdIn(...)
      Collectors.toMap(ChatRoom::getMentoringId, ChatRoom::getId)를 사용해 중복 키가 있을 경우 예외가 발생하도록 처리하고 있습니다.
    • 운영 환경에서 중복 채팅방이 생길 경우 더욱 명확한 방어 로직(병합 함수 제공 또는 커스텀 예외 메시지)이나
      DB 유니크 제약을 추가하는 것을 권장합니다.
src/main/java/com/example/solidconnection/mentor/dto/MentoringForMenteeResponse.java (1)

12-14: 4) chatRoomId 필드 추가는 요구사항과 맞습니다; null 정책과 스키마 문서화를 함께 정리하면 좋습니다.

    1. Long으로의 도입으로 null 허용이 명시됩니다. 직렬화 시 null 포함/제외 정책을 확정해 주세요(Swagger 문서/컨벤션).
    1. 가독성과 도구 친화성을 위해 @Nullable/@Schema(description=...) 등으로 의미를 문서화하면 클라이언트 협업이 수월합니다.

아래와 같이 컴포넌트에 주석(어노테이션)을 부여하는 방안을 고려해 주세요.

 public record MentoringForMenteeResponse(
         long mentoringId,
         String profileImageUrl,
         String nickname,
         boolean isChecked,
         ZonedDateTime createdAt,
-        Long chatRoomId
+        @Nullable
+        Long chatRoomId
 ) {

추가로, 필요한 경우 상단에 import를 보강합니다.

// 필요 시 추가
import org.springframework.lang.Nullable;
// 또는
// import io.swagger.v3.oas.annotations.media.Schema;

검증 포인트

  • API 문서에 “채팅방 미생성 시 chatRoomId = null” 명시 여부.
  • 전역 Jackson 설정(@JsonInclude.Include.NON_NULL 등)에 따른 null 직렬화 정책 일관성.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5616086 and 6bed161.

📒 Files selected for processing (7)
  • src/main/java/com/example/solidconnection/chat/repository/ChatRoomRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMenteeResponse.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMentorResponse.java (3 hunks)
  • src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java (3 hunks)
  • src/test/java/com/example/solidconnection/chat/fixture/ChatRoomFixture.java (1 hunks)
  • src/test/java/com/example/solidconnection/chat/fixture/ChatRoomFixtureBuilder.java (2 hunks)
  • src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/test/java/com/example/solidconnection/chat/fixture/ChatRoomFixture.java
  • src/main/java/com/example/solidconnection/chat/repository/ChatRoomRepository.java
  • src/test/java/com/example/solidconnection/chat/fixture/ChatRoomFixtureBuilder.java
  • src/main/java/com/example/solidconnection/mentor/dto/MentoringForMentorResponse.java
  • src/main/java/com/example/solidconnection/mentor/service/MentoringQueryService.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java (1)

7-8: 1) 채팅방 연동 import 추가가 테스트 변경과 자연스럽게 연결됩니다.

  • ChatRoom, ChatRoomFixture import는 아래 테스트 변경(채팅방 생성/검증)과 정확히 매칭됩니다.
src/main/java/com/example/solidconnection/mentor/dto/MentoringForMenteeResponse.java (1)

16-24: 2-인자 호출 마이그레이션 완료 확인

  1. 스크립트 개선
    • ast-grep 대신 ripgrep(rg)을 사용해 호출 패턴을 검색했습니다.
  2. 2-인자 호출 탐색
    • rg -nP '\bMentoringForMenteeResponse\.of\(\s*[^,]+,\s*[^,]+\s*\)' 검색 결과 잔여 호출이 없음이 확인되었습니다.
  3. 3-인자 호출 확인
    • rg -nP '\bMentoringForMenteeResponse\.of\(\s*[^,]+,\s*[^,]+,\s*[^)]+\)' 검색 결과 해당 호출이 아직 없습니다.
  4. 추가 권장
    • static import 형태로 of(…)를 직접 호출하는 패턴도 한 번 더 점검해 주세요.

이로써 기존 2-인자 시그니처 호출은 모두 제거된 상태이며, 빌드 타임 오류 위험은 없습니다.

- map이 아니라 순서가 보장되는 slice를 기준으로 순회하며 응답을 생성하도록
Comment on lines +16 to 24
public static MentoringForMenteeResponse of(Mentoring mentoring, SiteUser partner, Long chatRoomId) {
return new MentoringForMenteeResponse(
mentoring.getId(),
partner.getProfileImageUrl(),
partner.getNickname(),
mentoring.getCheckedAtByMentee() != null,
mentoring.getCreatedAt()
mentoring.getCreatedAt(),
chatRoomId
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

chatRoomId을 Long로 선언하여, null 의 가능성을 알려줍니다.
멘토링이 승인되지 않은 상태이면, 채팅방이 생기지 않아 chatRoomId가 null 이 됩니다.

Comment on lines +65 to +74
// N+1 을 해결하면서 멘토링의 채팅방 정보 조회
private Map<Long, Long> mapMentoringIdToChatRoomIdWithBatchQuery(List<Mentoring> mentorings) {
List<Long> mentoringIds = mentorings.stream()
.map(Mentoring::getId)
.distinct()
.toList();
List<ChatRoom> chatRooms = chatRoomRepository.findAllByMentoringIdIn(mentoringIds);
return chatRooms.stream()
.collect(Collectors.toMap(ChatRoom::getMentoringId, ChatRoom::getId));
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

멘토링 각각에 대한 채팅방 ID를 찾는 방법은 여러가지가 있을 것 같은데..
일단은 기존의 방식대로 구현했습니다😅

Comment on lines +18 to +24

public ChatRoom 멘토링_채팅방(long mentoringId) {
return chatRoomFixtureBuilder.chatRoom()
.mentoringId(mentoringId)
.isGroup(false)
.create();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"멘토링"으로 생긴 채팅방이 필요해서 픽스쳐 추가했는데,
제가 채팅 부분을 잘 아는게 아니라... 혹시 실수한 부분이 있다면 알려주세요!

Copy link
Member

Choose a reason for hiding this comment

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

구현하신 것처럼 mentoringId 만 추가하면 될 듯 합니다 !

Comment on lines +18 to +24

public ChatRoom 멘토링_채팅방(long mentoringId) {
return chatRoomFixtureBuilder.chatRoom()
.mentoringId(mentoringId)
.isGroup(false)
.create();
}
Copy link
Member

Choose a reason for hiding this comment

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

구현하신 것처럼 mentoringId 만 추가하면 될 듯 합니다 !

@nayonsoso nayonsoso merged commit 44184e2 into solid-connection:develop Aug 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: 멘토링 목록 조회 시 채팅방 id를 포함하여 응답하도록

3 participants