-
Notifications
You must be signed in to change notification settings - Fork 1
[feat] 반려견 DBTI 상세 분석 구현 및 프로필 조회 API 수정 #226
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
base: develop
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
Walkthrough이 PR은 반려견 DBTI 결과의 상세 분석 기능을 구현하기 위해 데이터 구조를 재구성합니다. DBTI 결과를 축별 분석(분석값, 라벨, 우세 방향) 리스트로 반환하도록 변경하고, 반려견 프로필 조회 API를 사용자 기반에서 펫 ID 기반으로 전환하며, 관련 서비스/파사드/저장소 레이어를 업데이트합니다. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
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
🤖 Fix all issues with AI agents
In
`@src/main/java/org/sopt/pawkey/backendapi/domain/pet/api/dto/response/PetProfileResponseDto.java`:
- Around line 36-45: formatAge currently uses ChronoUnit.MONTHS.between(birth,
LocalDate.now()) which can be negative for future birth dates; update formatAge
to detect months < 0 and handle it (e.g., return "정보 없음" or normalize to "0개월")
before the existing month/years logic so that negative values never produce
strings like "-1개월"; ensure you reference the formatAge method and the
ChronoUnit.MONTHS.between(birth, LocalDate.now()) result when adding the guard.
🧹 Nitpick comments (4)
src/main/java/org/sopt/pawkey/backendapi/domain/dbti/infra/persistence/entity/DbtiResultEntity.java (1)
69-75: 축 코드에 상수 사용을 고려해 주세요.
"EI","PS","RT"문자열 리터럴이 하드코딩되어 있습니다. 타입 안전성과 유지보수성을 위해 상수나 enum을 사용하는 것이 좋습니다. 또한"RT"코드가rfScore필드에 매핑되는데, 명명 불일치가 혼란을 줄 수 있습니다.추가로,
DBTI_NOT_FOUND에러 코드가 "유효하지 않은 축 코드" 상황에 의미상 정확하지 않을 수 있습니다.INVALID_AXIS_CODE와 같은 전용 에러 코드 추가를 검토해 주세요.♻️ 상수 추출 제안
+ private static final String AXIS_EI = "EI"; + private static final String AXIS_PS = "PS"; + private static final String AXIS_RT = "RT"; + public DbtiAnalysisResult getAnalysisOf(String axisCode) { int rawScore = switch (axisCode) { - case "EI" -> this.eiScore; - case "PS" -> this.psScore; - case "RT" -> this.rfScore; + case AXIS_EI -> this.eiScore; + case AXIS_PS -> this.psScore; + case AXIS_RT -> this.rfScore; default -> throw new DbtiBusinessException(DbtiErrorCode.DBTI_NOT_FOUND); };src/main/java/org/sopt/pawkey/backendapi/domain/pet/api/controller/PetController.java (1)
36-49: 메서드 명칭을 새 엔드포인트 의미에 맞게 정리하면 더 명확합니다.
getMyPet는/me/pets시절 네이밍이라,/{petId}로 변경된 만큼getPetProfile같은 명칭이 혼동을 줄일 수 있습니다.src/main/java/org/sopt/pawkey/backendapi/domain/dbti/infra/persistence/repository/DbtiRepositoryImpl.java (1)
41-44: 타입 목록의 반환 순서가 의미가 있다면 정렬을 명시해 주세요.
findAllTypes()가 기본 순서를 그대로 반환하므로, 응답 순서가 UI/분석 축 매핑에 영향을 준다면ORDER BY또는 후처리 정렬을 추가하는 편이 안전합니다.src/main/java/org/sopt/pawkey/backendapi/domain/dbti/api/dto/response/DbtiResultResponseDto.java (1)
28-51: analysis 리스트 순서를 명시적으로 고정하는 방어 로직을 권장합니다.
types입력 순서(=DB 조회 순서)에 의존하면 응답 순서가 환경/쿼리 변경에 따라 흔들릴 수 있습니다. 클라이언트가 순서에 의존한다면 이슈가 될 수 있어 정렬을 보장하는 편이 안전합니다.♻️ 정렬 추가 예시
types.stream() + .sorted(Comparator.comparing(DbtiTypeEntity::getCode)) .map(type -> { var analysisResult = result.getAnalysisOf(type.getCode());(참고:
Comparatorimport가 필요합니다.)
📌 PR 제목
[feat] 반려견 DBTI 상세 분석 구현 및 프로필 조회 API 수정
✨ 요약 설명
반려견의 DBTI 검사 결과를 상세하게 분석하여 제공하는 기능을 구현하고, 기획 변경 사항에 맞춰 반려견 프로필 조회 API의 응답 명세와 엔드포인트를 수정했습니다.
🧾 변경 사항
📂 PR 타입
🧪 테스트
✅ 체크리스트
💬 리뷰어에게 전달할 말
🔗 관련 이슈
Summary by CodeRabbit
릴리스 노트
새로운 기능
개선 사항
✏️ Tip: You can customize this high-level summary in your review settings.