-
Notifications
You must be signed in to change notification settings - Fork 0
feat(connection): 현재 connection attempt 조회 api 구현 #50
Conversation
Walkthrough이 PR은 연결 API의 새로운 컨트롤러와 도메인 모델을 OAS 모델로 전환하는 어댑터를 도입합니다. 또한, Changes
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 응답 전달
Possibly related PRs
Suggested reviewers
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
📒 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.id와user2.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 접근만 사용하는 방식을 잘 반영한 것으로 보입니다.
...src/main/kotlin/com/threedays/persistence/connection/repository/ParticipantRepositoryImpl.kt
Show resolved
Hide resolved
...n/kotlin/com/threedays/persistence/connection/adapter/ConnectionAttemptPersistenceAdapter.kt
Show resolved
Hide resolved
d8bd34a to
fcccfa1
Compare
There was a problem hiding this 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
📒 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
domain/src/main/kotlin/com/threedays/domain/connection/entity/Participant.kt
Show resolved
Hide resolved
bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/connection/OASModelAdapter.kt
Outdated
Show resolved
Hide resolved
infrastructure/persistence/src/main/resources/db/migration/V5__drop_participant.sql
Outdated
Show resolved
Hide resolved
…ection/OASModelAdapter.kt Co-authored-by: San Kim <waterfog9580@gmail.com>
…_drop_participant.sql Co-authored-by: San Kim <waterfog9580@gmail.com>
There was a problem hiding this 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
📒 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 스키마의 요구사항에 따라 포맷 일관성이 유지되는지 확인을 부탁드립니다.
There was a problem hiding this 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인스턴스를 생성하는 역할을 잘 수행하고 있습니다. 다만, 몇 가지 개선 사항을 제안합니다:
- URL이 하드코딩되어 있어 테스트 유연성이 제한됩니다.
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
📒 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 속성이 유지되는지 확인하는 것으로 변경된 점이 도메인 로직을 더 정확하게 반영합니다.
Summary by CodeRabbit
신규 기능
버그 수정
리팩토링