-
Notifications
You must be signed in to change notification settings - Fork 0
Issue: (#85) MY_02 (기능보완) 커플 생년월일 조회 기능 #86
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
Conversation
Walkthrough이번 변경 사항에서는 커플의 생년월일 정보를 조회하는 새로운 API 엔드포인트가 추가되었습니다. 이를 위해 커플 생년월일 응답용 DTO가 신설되었고, Facade 계층과 Controller 계층에 관련 메서드가 추가되었습니다. API 경로 상수도 추가되었으며, 커플 생년월일 조회 기능에 대한 단위 테스트가 작성되었습니다. 기존 로직에는 영향이 없으며, 새로운 기능과 관련된 코드만 변경되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Controller
participant Facade
participant CoupleInfoService
participant MemberService
User->>Controller: GET /v1/couple/birthday
Controller->>Facade: getCoupleBirthDay(customUserDetails)
Facade->>CoupleInfoService: findCoupleMember(userId)
Facade->>MemberService: getById(userId)
Facade->>Facade: CoupleBirthDayResponse.of(coupleMember, myMember)
Facade->>Controller: CoupleBirthDayResponse
Controller->>User: ApiResponse<CoupleBirthDayResponse>
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ 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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
Documentation and Community
|
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
🧹 Nitpick comments (5)
src/main/kotlin/gomushin/backend/couple/facade/CoupleFacade.kt (1)
134-134: 메서드 이름 대소문자 일관성 개선 필요
getCoupleBirthDay에서 'Day'가 대문자로 되어 있지만, 일반적인 Kotlin 네이밍 컨벤션에서는 'day'나 'date'를 사용합니다.getCoupleBirthday또는getCoupleBirthDate로 변경하는 것이 더 일관된 스타일이 될 것입니다.src/main/kotlin/gomushin/backend/couple/dto/response/CoupleBirthDayResponse.kt (3)
7-12: 속성 이름 대소문자 일관성 개선 필요
coupleBirthDay와myBirthDay에서 'Day'가 대문자로 되어 있습니다. Kotlin 네이밍 컨벤션에 따라coupleBirthday또는coupleBirthDate와 같이 소문자로 통일하는 것이 좋습니다.data class CoupleBirthDayResponse ( @Schema(description = "커플 생년월일", example = "2001-04-01") - val coupleBirthDay : LocalDate?, + val coupleBirthdate : LocalDate?, @Schema(description = "내 생년월일", example = "2001-03-01") - val myBirthDay : LocalDate? + val myBirthdate : LocalDate? ) {
9-11: null 처리에 대한 명확한 문서화 필요두 속성이 모두 nullable(
LocalDate?)로 선언되어 있습니다. 사용자가 생년월일을 설정하지 않은 경우 이 값들이 null일 수 있다는 것을 명확히 하기 위해 Swagger 문서에 이 정보를 추가하는 것이 좋습니다.@Schema(description = "커플 생년월일", example = "2001-04-01") val coupleBirthDay : LocalDate?, @Schema(description = "내 생년월일", example = "2001-03-01") val myBirthDay : LocalDate?수정 예시:
@Schema(description = "커플 생년월일 (설정되지 않은 경우 null)", example = "2001-04-01", nullable = true) val coupleBirthDay : LocalDate?, @Schema(description = "내 생년월일 (설정되지 않은 경우 null)", example = "2001-03-01", nullable = true) val myBirthDay : LocalDate?
14-17: companion object의 팩토리 메서드에서 매개변수 명확성 개선 필요현재 매개변수 이름
coupleMember와myMember는 상대방과 자신을 구분하는데 약간 모호할 수 있습니다.partnerMember와currentMember와 같이 더 명확한 이름을 사용하는 것이 좋습니다.companion object { - fun of(coupleMember : Member, myMember : Member) = CoupleBirthDayResponse( - coupleMember.birthDate, - myMember.birthDate + fun of(partnerMember : Member, currentMember : Member) = CoupleBirthDayResponse( + partnerMember.birthDate, + currentMember.birthDate ) }src/test/kotlin/gomushin/backend/couple/facade/CoupleFacadeTest.kt (1)
209-222: 커플 생년월일 조회 기능의 테스트 케이스가 잘 구현되었습니다.Given-When-Then 패턴을 명확하게 따르고 있으며, 필요한 서비스 호출이 적절하게 모킹되었습니다. 또한 결과값에 대한 검증도 적절히 이루어지고 있습니다.
추가 제안: 테스트의 완전성을 위해 customUserDetails.getId()가 호출되는 부분도 모킹하고 검증하는 것을 고려해 보세요.
//given +`when`(customUserDetails.getId()).thenReturn(1L) `when`(memberService.getById(customUserDetails.getId())).thenReturn(member1) `when`(coupleInfoService.findCoupleMember(customUserDetails.getId())).thenReturn(member2)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.github/workflows/deploy.yml(1 hunks)src/main/kotlin/gomushin/backend/couple/dto/response/CoupleBirthDayResponse.kt(1 hunks)src/main/kotlin/gomushin/backend/couple/facade/CoupleFacade.kt(1 hunks)src/main/kotlin/gomushin/backend/couple/presentation/ApiPath.kt(1 hunks)src/main/kotlin/gomushin/backend/couple/presentation/CoupleInfoController.kt(1 hunks)src/test/kotlin/gomushin/backend/couple/facade/CoupleFacadeTest.kt(3 hunks)
🔇 Additional comments (4)
.github/workflows/deploy.yml (1)
6-7: Pull Request에 대한 CI/CD 파이프라인 실행이 추가되었습니다.main 브랜치를 대상으로 하는 Pull Request에 대해서도 워크플로우가 실행되도록 설정이 추가되었습니다. 이는 코드가 main 브랜치에 병합되기 전에 모든 테스트와 검증을 통과하도록 하는 좋은 방식입니다.
src/main/kotlin/gomushin/backend/couple/presentation/ApiPath.kt (1)
19-19: 커플 생년월일 조회 API 경로가 적절하게 추가되었습니다.기존의 API 경로 네이밍 컨벤션과 일관되게 새로운 엔드포인트가 추가되었습니다.
src/test/kotlin/gomushin/backend/couple/facade/CoupleFacadeTest.kt (1)
65-65: 테스트 데이터 초기화가 적절하게 이루어졌습니다.커플 생년월일 조회 기능 테스트를 위해 Member 객체들에 명시적인 생년월일 값을 설정한 것이 좋습니다. 이전에는 null 값이었던 것을 구체적인 날짜로 변경하여 테스트의 명확성을 높였습니다.
Also applies to: 76-76
src/main/kotlin/gomushin/backend/couple/presentation/CoupleInfoController.kt (1)
75-83: 커플 생년월일 조회 API 엔드포인트가 적절하게 구현되었습니다.새로운 기능에 대한 API 엔드포인트가 기존 컨트롤러 패턴과 일관성 있게 추가되었습니다. HTTP 상태 코드, 엔드포인트 경로, Swagger 문서화가 모두 적절히 구성되어 있습니다.
서비스 계층과의 연계도 잘 구현되어 있으며, 응답 형식도 기존 API 패턴을 따르고 있습니다.
| fun getCoupleBirthDay(customUserDetails: CustomUserDetails): CoupleBirthDayResponse { | ||
| val couple = coupleInfoService.findCoupleMember(customUserDetails.getId()) | ||
| val member = memberService.getById(customUserDetails.getId()) | ||
| return CoupleBirthDayResponse.of(couple, member) | ||
| } |
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.
커플 연결 여부에 대한 예외 처리가 필요합니다.
현재 구현에서는 사용자가 커플로 연결되어 있지 않은 경우에 대한 예외 처리가 누락되어 있습니다. getInfo() 메서드(24-33줄)와 같이 checkIsCouple()을 통해 사용자가 커플로 연결되어 있는지 확인하는 로직을 추가해야 합니다.
fun getCoupleBirthDay(customUserDetails: CustomUserDetails): CoupleBirthDayResponse {
+ val member = memberService.getById(customUserDetails.getId())
+
+ if (!member.checkIsCouple()) {
+ throw BadRequestException("saranggun.couple.not-connected")
+ }
+
val couple = coupleInfoService.findCoupleMember(customUserDetails.getId())
- val member = memberService.getById(customUserDetails.getId())
return CoupleBirthDayResponse.of(couple, member)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fun getCoupleBirthDay(customUserDetails: CustomUserDetails): CoupleBirthDayResponse { | |
| val couple = coupleInfoService.findCoupleMember(customUserDetails.getId()) | |
| val member = memberService.getById(customUserDetails.getId()) | |
| return CoupleBirthDayResponse.of(couple, member) | |
| } | |
| fun getCoupleBirthDay(customUserDetails: CustomUserDetails): CoupleBirthDayResponse { | |
| val member = memberService.getById(customUserDetails.getId()) | |
| if (!member.checkIsCouple()) { | |
| throw BadRequestException("saranggun.couple.not-connected") | |
| } | |
| val couple = coupleInfoService.findCoupleMember(customUserDetails.getId()) | |
| return CoupleBirthDayResponse.of(couple, member) | |
| } |
HoyeongJeon
left a comment
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.
굿
src/main/kotlin/gomushin/backend/couple/dto/response/CoupleBirthDayResponse.kt
Outdated
Show resolved
Hide resolved
…생일임을 더 잘 나타내주는 것 같아서 수정) #85
✅ PR 유형
어떤 변경 사항이 있었나요?
📝 작업 내용
#85
Summary by CodeRabbit
신규 기능
/v1/couple/birthday)가 추가되었습니다.테스트