Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Conversation

@dojinyou
Copy link
Collaborator

@dojinyou dojinyou commented Apr 13, 2025

Summary by CodeRabbit

  • 신규 기능

    • 사용자 인증 후 현재 연결 시도 정보를 확인할 수 있는 기능이 추가되었습니다.
    • 연결 정보에 참여자의 이름, 전화번호 및 프로필 이미지 등 상세 정보가 제공됩니다.
    • 참여자 정보를 가져오는 새로운 데이터 접근 인터페이스 및 구현체가 도입되었습니다.
    • 테스트용 사용자 생성 유틸리티가 추가되어 테스트 데이터 관리가 용이해졌습니다.
    • 데이터베이스에서 참여자 테이블을 안전하게 삭제하는 SQL 마이그레이션이 추가되었습니다.
  • 버그 수정

    • 연결 시도 데이터의 변환 및 저장 방식이 개선되어 데이터의 일관성이 향상되었습니다.
  • 리팩토링

    • 연결 매칭 및 참여자 처리 방식이 개편되어 데이터 전달이 더욱 일관되고 안정적으로 개선되었습니다.
    • 참여자 엔티티 관리 방식이 UUID 기반으로 변경되어 데이터 모델이 단순화되었습니다.
    • 데이터 변환 및 저장 방식이 최적화되어 시스템 전반의 안정성이 향상되었습니다.

@dojinyou dojinyou requested a review from waterfogSW as a code owner April 13, 2025 16:00
@coderabbitai
Copy link

coderabbitai bot commented Apr 13, 2025

Walkthrough

이 PR은 연결 API의 새로운 컨트롤러와 도메인 모델을 OAS 모델로 전환하는 어댑터를 도입합니다. 또한, ConnectionParticipant 도메인 엔티티가 User 객체 기반으로 재구성되었으며, 테스트 코드 역시 이에 맞게 업데이트되었습니다. 퍼시스턴스 계층에서는 연결 시도와 관련된 로직이 개선되고, 참여자 데이터를 위한 새로운 리포지토리 인터페이스 및 구현체가 추가되었습니다. 마지막으로, 기존 Participant 관련 JPA 엔티티가 제거되고, 데이터베이스 스키마 변경을 위한 SQL 마이그레이션 파일이 도입되었습니다.

Changes

파일 경로 변경 요약
bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/ConnectionController.kt
bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt
새로운 연결 API 컨트롤러와 도메인 모델을 OAS 모델로 변환하는 어댑터 추가.
domain/src/main/kotlin/com/threedays/domain/connection/entity/Connection.kt
domain/src/main/kotlin/com/threedays/domain/connection/entity/Participant.kt
domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionTest.kt
domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionAttemptTest.kt
domain/src/test/kotlin/com/threedays/domain/user/entity/UserMother.kt
Connection.match 메서드가 User 객체 사용으로 변경되고, Participant 클래스가 재구성되며, 테스트 코드가 User 객체 기반으로 업데이트되고 UserMother 테스트 유틸리티 추가.
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/adapter/ConnectionAttemptPersistenceAdapter.kt
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionAttemptJpaEntity.kt
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionJpaEntity.kt
퍼시스턴스 어댑터 및 JPA 엔티티 업데이트로, 최신 연결 시도 로직 및 참가자 정보 처리를 개선 (참가자 UUID 기반).
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantEntity.kt
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantJpaEntity.kt (삭제)
ParticipantEntity 클래스 추가 및 기존 ParticipantJpaEntity 제거.
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepository.kt
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepositoryImpl.kt
새로운 참여자 리포지토리 인터페이스와 구현체 추가.
infrastructure/persistence/src/main/resources/db/migration/V5__drop_participant.sql participant 테이블의 존재 여부를 확인 후 삭제하는 SQL 마이그레이션 파일 추가.

Sequence Diagram(s)

sequenceDiagram
    participant U as 사용자
    participant CC as ConnectionController
    participant Auth as withUserAuthentication
    participant GA as GetCurrentConnectionAttempt
    participant OAS as OASModelAdapter

    U->>CC: connectionsMyCurrentGet 요청
    CC->>Auth: 사용자 인증 처리
    Auth-->>CC: 인증된 사용자 정보 반환
    CC->>GA: getCurrentConnectionAttempt 호출
    GA-->>CC: ConnectionAttempt 도메인 객체 반환
    CC->>OAS: toOASModel 호출하여 변환
    OAS-->>CC: OAS 모델 반환
    CC->>U: HTTP 200 OK 응답 전달
Loading

Possibly related PRs

Suggested reviewers

  • waterfogSW

Poem

당근밭을 달리는 귀여운 토끼
새롭게 춤추는 API와 어댑터의 향연
도메인과 퍼시스턴스가 손잡아 노래하네
User와 Participant가 산뜻하게 어우러져
코드 속 봄바람처럼 즐거운 날,
우리 모두 한껏 웃으며 달려가요 🐰✨
행복한 코드, 당근처럼 달콤해!

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

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: 2

🧹 Nitpick comments (3)
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepository.kt (1)

7-10: 인터페이스 설계 검토

ParticipantRepository 인터페이스가 간결하게 설계되었습니다. getAllParticipants 메서드는 여러 참여자 ID를 기반으로 참여자 정보를 일괄 조회할 수 있는 기능을 제공합니다.

다만, 현재는 조회 기능만 있고 생성, 수정, 삭제 기능이 없습니다. 필요에 따라 이러한 기능을 추가하는 것을 고려해 볼 수 있습니다.

필요에 따라 추가 기능을 구현할 수 있습니다:

interface ParticipantRepository {
    fun getAllParticipants(participantIds: Set<UUID>): Map<UUID, ParticipantEntity>
    
    // 추가 기능 예시
    fun getParticipant(participantId: UUID): ParticipantEntity?
    fun saveParticipant(participant: ParticipantEntity): ParticipantEntity
    // 필요에 따라 추가
}
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionAttemptJpaEntity.kt (1)

75-83: **새로운 오버로딩 메서드 도입 **

toDomainEntity(connection: Connection) 메서드를 통해 필요한 경우에만 connection 값을 주입할 수 있게 되었습니다. 다만, toDomainEntity() 메서드가 두 가지 형태(기본/오버로딩)로 존재해 혼선을 줄 수 있으니, 명확한 코멘트나 메서드명 변경을 고려해 볼 수도 있습니다.

bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt (1)

1-46: **도메인 → OAS 변환 로직에 대한 소소한 포맷팅 제안 **

날짜·시간을 toString()으로 직접 변환하고 있는데, 특정 형식을 고정해야 하는 경우에는 DateTimeFormatter를 사용하거나 별도의 공통 포맷팅 로직을 두는 방식을 고려해 볼 수 있습니다. 예를 들어, 아래처럼 포맷터를 이용할 수 있습니다:

val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
domainModel.attemptDate.format(formatter)

이렇게 하면 API 클라이언트와 일관성 있는 형식으로 통신할 수 있습니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dbc6cd6 and d8bd34a.

📒 Files selected for processing (13)
  • bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/ConnectionController.kt (1 hunks)
  • bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt (1 hunks)
  • domain/src/main/kotlin/com/threedays/domain/connection/entity/Connection.kt (1 hunks)
  • domain/src/main/kotlin/com/threedays/domain/connection/entity/Participant.kt (1 hunks)
  • domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionTest.kt (2 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/adapter/ConnectionAttemptPersistenceAdapter.kt (1 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionAttemptJpaEntity.kt (2 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionJpaEntity.kt (4 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantEntity.kt (1 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantJpaEntity.kt (0 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepository.kt (1 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepositoryImpl.kt (1 hunks)
  • infrastructure/persistence/src/main/resources/db/migration/V5__drop_participant.sql (1 hunks)
💤 Files with no reviewable changes (1)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantJpaEntity.kt
🧰 Additional context used
🧬 Code Graph Analysis (1)
bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/ConnectionController.kt (1)
bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/support/security/authExtension.kt (1)
  • withUserAuthentication (6-14)
🔇 Additional comments (23)
domain/src/main/kotlin/com/threedays/domain/connection/entity/Participant.kt (4)

3-7: 적절한 임포트 추가

적절한 임포트가 추가되었습니다. 특히 User 관련 클래스들을 명시적으로 임포트하여 코드의 가독성이 향상되었습니다.


10-18: KDoc 주석 업데이트 완료

KDoc 주석이 새로운 매개변수에 맞게 적절히 업데이트되었습니다. 각 필드의 역할과 의미가 명확하게 설명되어 있습니다.


19-25: 데이터 클래스 구조 개선

Participant 클래스가 User 객체의 관련 정보를 직접 포함하도록 개선되었습니다. 이전의 connectionResponse 필드가 제거되고, 사용자 관련 필드들이 추가되어 더 명확하고 구체적인 모델링이 가능해졌습니다.


27-37: 유용한 팩토리 메서드 추가

User 객체로부터 Participant 객체를 생성하는 팩토리 메서드가 추가되었습니다. 이는 객체 생성 로직을 캡슐화하고 코드 재사용성을 높이는 좋은 방법입니다.

infrastructure/persistence/src/main/resources/db/migration/V5__drop_participant.sql (1)

1-1: 참여자 테이블 삭제 마이그레이션

안전하게 participant 테이블을 삭제하는 SQL 문이 작성되었습니다. IF EXISTS 구문을 사용하여 테이블이 존재하지 않는 경우에도 오류가 발생하지 않도록 처리되었습니다.

다만, 테이블 삭제 전에 기존 데이터가 다른 테이블로 마이그레이션되었는지 확인하고, 이 변경이 다른 데이터베이스 관련 코드에 미치는 영향을 고려해야 합니다.

기존 participant 테이블의 데이터가 다른 곳으로 마이그레이션되었는지 확인해주세요. 이 변경사항이 애플리케이션의 다른 부분에 어떤 영향을 미치는지 검토가 필요합니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepository.kt (1)

1-6: 적절한 임포트와 패키지 구조

필요한 임포트와 패키지 구조가 적절하게 설정되었습니다. UUID 타입을 사용하는 것이 참여자 식별에 적합합니다.

domain/src/main/kotlin/com/threedays/domain/connection/entity/Connection.kt (2)

40-43: 매개변수 타입 개선

match 메서드의 매개변수가 User.Id에서 User 객체로 변경되었습니다. 이는 Participant.from(user) 메서드와 일관성을 유지하며, 사용자 데이터를 더 효율적으로 활용할 수 있게 합니다.


46-48: 객체 생성 로직 개선

Participant 객체 생성 시 직접 생성자를 호출하는 대신 Participant.from(user) 팩토리 메서드를 사용하여 코드의 가독성과 유지보수성이 향상되었습니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantEntity.kt (1)

8-20: 코드가 명확하고 잘 구현되었습니다.

ParticipantEntity 클래스는 UserJpaEntity를 받아 도메인 객체 Participant로 변환하는 역할을 잘 수행하고 있습니다. 각 필드가 적절하게 매핑되어 있으며, 도메인 모델 변환 로직이 깔끔합니다.

domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionTest.kt (5)

6-7: 적절한 임포트 추가.

User 엔티티와 UUIDTypeId 타입을 위한 임포트가 추가되었습니다.


9-12: 테스트 관련 임포트 변경 확인.

테스트 라이브러리 임포트가 적절히 변경되었습니다.


27-28: ID 대신 사용자 객체 직접 사용으로 개선.

이전에는 UUID를 직접 생성했지만 이제 FixtureMonkey를 사용하여 완전한 User 객체를 생성합니다. 이 방식은 더 실제적인 테스트 환경을 제공합니다.


32-32: User 객체를 직접 사용하도록 Connection.match 메서드 호출 변경.

ID 대신 User 객체를 직접 전달하여 메서드를 호출하도록 변경되었습니다. 이는 도메인 모델의 변경을 잘 반영하고 있습니다.


38-39: User ID 참조 방식 업데이트.

이제 user1.iduser2.id를 사용하여 참가자 확인을 수행합니다. 이는 도메인 객체의 구조를 제대로 활용하는 방식으로 변경되었습니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepositoryImpl.kt (1)

8-15: 참가자 저장소 구현이 간결하게 잘 되었습니다.

Spring의 @Repository 어노테이션을 적절히 사용하고, 인터페이스를 잘 구현했습니다. 메소드 구현이 간결하고 효율적입니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/adapter/ConnectionAttemptPersistenceAdapter.kt (2)

8-8: 새로운 ParticipantRepository 임포트 추가.

참가자 정보를 가져오기 위해 필요한 적절한 임포트입니다.


14-14: ParticipantRepository 의존성 추가.

참가자 정보를 가져오기 위한 저장소 의존성이 적절히 추가되었습니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionAttemptJpaEntity.kt (2)

3-3: **import 추가 확인 **

Connection 클래스를 사용하는 새로운 메서드를 위해 import com.threedays.domain.connection.entity.Connection이 추가되었습니다. 적절한 변경으로 보이며, 문제 없어 보입니다.


69-73: **connection을 null로 설정하는 변경에 대한 확인 요청 **

toDomainEntity() 메서드에서 connection 필드를 무조건 null로 설정하도록 수정되었습니다. 기존 사용처에서 도메인 객체에 connection이 필요하지 않다면 문제 없겠지만, 과거에 connection?.toDomain()을 사용하던 로직이 있었다면 동작이 달라질 수 있습니다. 이 변경이 타 로직에 영향을 주지 않는지 한번 점검해 보시길 권장합니다.

bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/ConnectionController.kt (1)

1-30: **성공 상태 반환에 대한 예외 처리 고려 **

connectionsMyCurrentGet() 메서드 내에서 withUserAuthentication를 통해 사용자 인증을 수행한 뒤, 항상 ResponseEntity.ok(...)를 반환하고 있습니다. getCurrentConnectionAttempt.invoke()에서 예외가 발생하거나 데이터가 유효하지 않을 경우 어떤 응답을 줄지도 고민해 보시는 것이 좋겠습니다. 필요하다면 4xx, 5xx 응답 등을 추가로 처리해 안정성을 높일 수 있습니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionJpaEntity.kt (3)

19-20: **ID 기반 매핑으로의 전환 **

participant1Id, participant2Id 컬럼으로 직접 UUID만 저장하도록 변경되어, 이전에 참조하던 ParticipantJpaEntity 없이도 가볍게 유지관리할 수 있게 되었습니다. 데이터베이스 구조 및 JPA 설정 모두 간단해진 이점이 있어 보이며, 변경 방향이 타당해 보입니다.

Also applies to: 33-34


49-53: **toDomain() 메서드 호출 전 참여자 로딩 여부 확인 **

도메인 변환 시 participant1, participant2를 외부에서 받아 주입하도록 설계되었습니다. 이 로직을 사용할 때, 반드시 DB 혹은 해당 도메인을 미리 로딩해 Participant 객체를 생성해야 합니다. 실제 사용처에서 이 부분이 안정적으로 처리되는지 확인 부탁드립니다.


63-64: **companion object 변환 로직 **

domain.participant1.id.value, domain.participant2.id.value로 UUID를 얻어 DB 컬럼에 매핑하는 과정이 명확하게 진행되었습니다. 도메인에서 필요한 정보만 간단히 추출하기 위해 ID 접근만 사용하는 방식을 잘 반영한 것으로 보입니다.

@dojinyou dojinyou force-pushed the feature/get-current-connection-attempt-api branch from d8bd34a to fcccfa1 Compare April 13, 2025 16:06
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

♻️ Duplicate comments (1)
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/adapter/ConnectionAttemptPersistenceAdapter.kt (1)

18-29: Non-null 단언 연산자(!!) 사용으로 인한 안전성 문제
참가자 정보를 조회하지 못하면 null이 반환될 수 있으므로 !!.toDomain()는 NPE를 유발할 수 있습니다. 이전 리뷰에서 이미 지적된 사항과 동일하므로 재검토하시는 것이 좋습니다. 안전하게 예외를 처리하거나 옵셔널 체이닝을 고려해보세요.

-val participant1 = idToParticipant[connectionJpaEntity.participant1Id]!!.toDomain()
-val participant2 = idToParticipant[connectionJpaEntity.participant2Id]!!.toDomain()
+val participant1 = idToParticipant[connectionJpaEntity.participant1Id]?.toDomain() 
+    ?: throw IllegalStateException("참가자1(ID: ${connectionJpaEntity.participant1Id})가 존재하지 않습니다.")
+val participant2 = idToParticipant[connectionJpaEntity.participant2Id]?.toDomain() 
+    ?: throw IllegalStateException("참가자2(ID: ${connectionJpaEntity.participant2Id})가 존재하지 않습니다.")
🧹 Nitpick comments (3)
domain/src/main/kotlin/com/threedays/domain/connection/entity/Participant.kt (1)

20-25: 도메인 엔티티 구조 변경이 적절합니다.

기존의 connectionResponse 필드를 제거하고 사용자 정보를 직접 포함하도록 변경한 것은 좋은 접근입니다. 이렇게 하면 Participant가 자체적으로 모든 필요한 정보를 포함하여 독립적으로 작동할 수 있습니다.

그러나 한 가지 고려해볼 점: id의 타입이 여전히 User.Id인데, 이는 주석에서 '참여자 식별자 ID'라고 설명된 것과 약간 혼란을 줄 수 있습니다. 실제로 사용자 ID를 참여자 ID로 사용하는 것이 의도적인지 확인해보세요.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionJpaEntity.kt (2)

19-20: participant1Id/participant2Id 필드를 통한 식별자 기반 매핑
엔티티 직접 참조 대신 UUID를 보관하여 DB 종속성을 줄이는 점은 긍정적입니다. 다만, nullable = false로 명시된 만큼 항상 유효한 두 참가자가 존재한다는 비즈니스 규칙이 확실한지 재확인해 주세요.

Also applies to: 29-30, 33-34


63-64: from 메소드에서 UUID 마이그레이션 로직 확인
도메인에서 이미 Participant 객체를 보유하더라도 이곳에서는 ID만 추출해 매핑하고 있습니다. 추후 참가자 정보를 깊이 있게 활용할 가능성이 있다면, 현재 구조가 확장성에 제약이 없는지 검토가 필요합니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d8bd34a and fcccfa1.

📒 Files selected for processing (13)
  • bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/ConnectionController.kt (1 hunks)
  • bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt (1 hunks)
  • domain/src/main/kotlin/com/threedays/domain/connection/entity/Connection.kt (1 hunks)
  • domain/src/main/kotlin/com/threedays/domain/connection/entity/Participant.kt (1 hunks)
  • domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionTest.kt (2 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/adapter/ConnectionAttemptPersistenceAdapter.kt (1 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionAttemptJpaEntity.kt (2 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionJpaEntity.kt (4 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantEntity.kt (1 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantJpaEntity.kt (0 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepository.kt (1 hunks)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepositoryImpl.kt (1 hunks)
  • infrastructure/persistence/src/main/resources/db/migration/V5__drop_participant.sql (1 hunks)
💤 Files with no reviewable changes (1)
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantJpaEntity.kt
🚧 Files skipped from review as they are similar to previous changes (8)
  • infrastructure/persistence/src/main/resources/db/migration/V5__drop_participant.sql
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepository.kt
  • domain/src/main/kotlin/com/threedays/domain/connection/entity/Connection.kt
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ParticipantEntity.kt
  • domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionTest.kt
  • infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionAttemptJpaEntity.kt
  • bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/ConnectionController.kt
  • bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt
🔇 Additional comments (6)
domain/src/main/kotlin/com/threedays/domain/connection/entity/Participant.kt (2)

3-7: 새 의존성 추가가 적절히 이루어졌습니다.

User 객체를 기반으로 Participant를 재구성하기 위해 필요한 모든 임포트가 올바르게 추가되었습니다. 이를 통해 코드 가독성과 유지보수성이 향상됩니다.


27-37: User 객체로부터 Participant를 생성하는 팩토리 메서드가 잘 구현되었습니다.

from(user: User) 메서드는 도메인 로직을 명확하게 표현하고 있으며, User 객체에서 Participant 객체로의 변환 과정을 잘 캡슐화하고 있습니다. 이는 코드 재사용성을 높이고 오류 가능성을 줄입니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/adapter/ConnectionAttemptPersistenceAdapter.kt (2)

8-8: 주입된 ParticipantRepository 임포트 확인
사용하지 않는다면 제거하시고, 필수 의존성이라면 빈 등록 및 사용 여부를 꼼꼼히 점검해주시기 바랍니다.


14-14: ParticipantRepository 주입 방식 주의
이 레포지토리를 통해 참가자 정보를 조회하므로, 빈 주입 및 스코프가 정상적으로 동작하는지 한번 더 확인 부탁드립니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepositoryImpl.kt (1)

12-20: getAllParticipants 메소드의 예외 처리 및 로직 점검
요청한 ID 대비 조회된 사용자 수가 일치하지 않을 경우 예외를 던지는 방식은 명확하고 신뢰도가 높습니다. 단, 일부 참가자가 누락되어도 계속 진행해야 하는 시나리오가 있다면, 누락된 항목만 제외하는 로직을 고려하는 방안도 있을 수 있으니 필요 시 검토 부탁드립니다.

infrastructure/persistence/src/main/kotlin/com/threedays/persistence/connection/entity/ConnectionJpaEntity.kt (1)

49-49: toDomain 메소드에서 참가자 정보를 직접 주입받는 구조
외부에서 이미 변환된 도메인 참가자를 인자로 받아 매핑하는 방식으로 책임이 분리되어 있습니다. 다만, ConnectionJpaEntity 내부에서 추가 로직 없이 단순 할당만 수행하므로, 사용 시점에 주의하여야 합니다.

Also applies to: 52-53

dojinyou and others added 2 commits April 14, 2025 22:32
…ection/OASModelAdapter.kt

Co-authored-by: San Kim <waterfog9580@gmail.com>
…_drop_participant.sql

Co-authored-by: San Kim <waterfog9580@gmail.com>
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 (2)
bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt (2)

34-36: ConnectionCancellation 변환 시 예외 처리 고려 권장

ConnectionCancellationReason.valueOf(domainModel.reason.name) 호출에서, 예상하지 못한 이름이 들어오면 IllegalArgumentException이 발생할 수 있습니다. 유효성 검사 혹은 예외 처리를 추가하는 방안을 생각해볼 수 있습니다.


38-45: Participant 매핑 시 널 안전성 점검 권장

domainModel.profile, profileWidgets, profileImages 등이 널이 아닐 것이라 기대하고 있습니다. 추후 null-safe 보장이나 널 검사 로직을 병행한다면 에러 예방에 도움이 될 것입니다.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fcccfa1 and 136888d.

📒 Files selected for processing (2)
  • bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt (1 hunks)
  • infrastructure/persistence/src/main/resources/db/migration/V5__drop_participant.sql (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • infrastructure/persistence/src/main/resources/db/migration/V5__drop_participant.sql
🔇 Additional comments (3)
bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt (3)

13-20: 도메인에서 OAS 모델로의 매핑 로직이 명확합니다.

ConnectionAttempt의 필드들을 일관성 있게 OAS 모델로 변환하고 있습니다. 다른 호출부에서 toOASModel을 사용하는 경우에도 동일한 변환 로직이 적용될 것으로 보여 재사용성이 높아 보입니다.


14-19: 날짜/시간 문자열 포맷을 검토해주세요.

attemptDate, createdAt 같은 시간을 단순 toString()으로 변환할 때, 프로젝트 전반의 일관된 포맷(예: ISO 8601)인지 확인이 필요할 수 있습니다.


22-27: Connection 매핑 시 날짜/시간 포맷 일관성 확인 필요

connectedAt 필드도 위와 동일하게 toString()을 사용하고 있습니다. 다른 API나 OAS 스키마의 요구사항에 따라 포맷 일관성이 유지되는지 확인을 부탁드립니다.

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 (1)
domain/src/test/kotlin/com/threedays/domain/user/entity/UserMother.kt (1)

9-45: 테스트 데이터 생성 유틸리티 클래스가 잘 구현되었습니다.

UserMother 클래스가 테스트에서 일관된 User 인스턴스를 생성하는 역할을 잘 수행하고 있습니다. 다만, 몇 가지 개선 사항을 제안합니다:

  1. URL이 하드코딩되어 있어 테스트 유연성이 제한됩니다.
  2. createUser() 메서드가 매개변수를 받지 않아 기본값을 오버라이드할 수 없습니다.

사용자 정의 값을 허용하도록 메서드를 개선해 보세요:

-fun createUser() : User {
+fun createUser(
+    name: User.Name = User.Name("홍길동"),
+    imageUrl: URL = URL("http://example.com")
+) : User {
    val phoneNumber = PhoneNumber("010${generateLast8PhoneNumberDigits()}")
    val userProfile = fixtureMonkey
        .giveMeBuilder<UserProfile>()
        .set(UserProfile::company, null)
        .sample()

    val userDesiredPartner = fixtureMonkey
        .giveMeBuilder<UserDesiredPartner>()
        .set(UserDesiredPartner::allowSameCompany, null)
        .sample()

-    val userProfileImageUrl: URL = URL("http://example.com")
+    val userProfileImageUrl: URL = imageUrl
    val userProfileImage = fixtureMonkey
        .giveMeBuilder<UserProfileImage>()
        .set(UserProfileImage::url, userProfileImageUrl)
        .sampleList(1)

    return fixtureMonkey
        .giveMeBuilder<User>()
-        .set(User::name, User.Name("홍길동"))
+        .set(User::name, name)
        .set(User::phoneNumber, phoneNumber)
        .set(User::profile, userProfile)
        .set(User::profileImages, userProfileImage)
        .set(User::desiredPartner, userDesiredPartner)
        .sample()
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 136888d and 2b88804.

📒 Files selected for processing (3)
  • domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionAttemptTest.kt (4 hunks)
  • domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionTest.kt (3 hunks)
  • domain/src/test/kotlin/com/threedays/domain/user/entity/UserMother.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionTest.kt
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Run unit test and static analysis
🔇 Additional comments (4)
domain/src/test/kotlin/com/threedays/domain/connection/entity/ConnectionAttemptTest.kt (4)

21-21: 테스트 코드가 UserMother를 적절히 활용하고 있습니다.

UserMother 인스턴스를 생성하여 테스트 사용자 객체 생성을 표준화한 것은 좋은 접근법입니다.


42-46: 도메인 모델 변경에 맞게 테스트 코드가 잘 수정되었습니다.

User 객체를 통한 Connection 생성 방식으로 변경된 점이 명확하게 반영되었습니다. 이전에 User.Id만 사용하던 것에서 전체 User 객체를 사용하도록 변경된 도메인 모델 변화가 테스트에 잘 반영되었습니다.


59-66: 연결 실패 테스트 케이스의 구조가 개선되었습니다.

User 객체를 활용한 테스트 구조가 일관되게 적용되었고, 특히 fail() 메서드를 호출하는 방식으로 테스트가 명확해졌습니다.


69-69: assertion 변경이 적절합니다.

실패 상태에서도 connection 속성이 유지되는지 확인하는 것으로 변경된 점이 도메인 로직을 더 정확하게 반영합니다.

@dojinyou dojinyou merged commit c91fa59 into main Apr 20, 2025
1 of 3 checks passed
@dojinyou dojinyou deleted the feature/get-current-connection-attempt-api branch April 20, 2025 18:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants