[FEAT] 학습 조회 API 구현 (1/3) - 학습 주제 전체보기 · 실습 데이터 조회#50
Conversation
|
Warning Review limit reached
Next review available in: 36 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthrough학습 단계별 연습 실행 정보와 난이도별 이론 목록 조회 API가 추가되었습니다. 응답 DTO, 저장소 조회 메서드, 입력·존재성 검증, 오류 상태, 컨트롤러 테스트와 OpenAPI 문서가 함께 반영되었습니다. Changes학습 조회 기능
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant LearningController
participant LearningService
participant Repository
Client->>LearningController: 조회 요청
LearningController->>LearningService: learningId, stepId, difficulty 전달
LearningService->>Repository: 검증 및 조건부 학습 데이터 조회
Repository-->>LearningService: 엔티티 또는 PlayingExample 반환
LearningService-->>LearningController: 응답 DTO 반환
LearningController-->>Client: ApiResponse 반환
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
| public record PracticeDataResultDTO( | ||
| Integer bpm, | ||
| String keySignature, | ||
| String midiData |
There was a problem hiding this comment.
P2: midiData가 DB에서는 JSON으로 저장되지만 응답 DTO에서는 String
API 응답에서 JSON 객체가 아닌 이스케이프된 문자열로 반환될 우려가 있습니다!
프론트에서 MIDI 데이터를 객체나 배열로 바로 사용해야 하는 명세라면 JsonNode 또는 별도의 MIDI 응답 DTO로 반환하는 방향을 고려하면 좋을 것 같아요.
현재처럼 문자열 반환이 의도된 것인지 확인 부탁드립니다!
There was a problem hiding this comment.
앗 맞아요 DB엔 JSON으로 저장되는데 응답 DTO에서 String 그대로 내려가면서 이스케이프된 문자열로 나가고 있었네요. @JsonRawValue 붙여서 실제 JSON 객체로 나가도록 수정했습니다. 확인 감사합니다!!
| throw new GeneralException(LearningErrorStatus.INVALID_DIFFICULTY); | ||
| } | ||
| try { | ||
| return LearningDifficulty.valueOf(difficulty); |
There was a problem hiding this comment.
P2: 소문자나 앞뒤 공백이 포함된 값도 모두 400으로 처리될 우려
항상 대문자 enum 값을 전달하도록 약속된 경우에는 괜찮지만, 입력 유연성을 고려한다면 trim()과 toUpperCase()로 정규화한 뒤 변환하는 방법도 고려해 보면 좋을 것 같습니다~
There was a problem hiding this comment.
클라이언트에서 직접 입력하는 값이 아니라, 현재는 큰 문제가 없어 보이긴 하지만, 정규화 후 변환을 고려해도 좋을 것 같아 의견 남깁니다.
There was a problem hiding this comment.
말씀하신 대로 trim()+toUpperCase() 넣었습니다.
겸사겸사 toUpperCase()에 로케일 안 주면 터키어 로케일 같은 데서 i가 İ로 바뀌는 이슈가 있어서
Locale.ROOT도 같이 넣어뒀어요. 좋은 의견 감사합니다!
on1yoneprivate
left a comment
There was a problem hiding this comment.
로직상 크게 문제되는 부분은 없어 승인했습니다!
코멘트로 남긴 부분들은 필수 수정 사항이라기보다는, 추후 유지보수성과 확장성을 고려한 제안 사항입니다. 편하실 때 검토 부탁드립니다~
rkdehdrbs7885-oss
left a comment
There was a problem hiding this comment.
작업 고생 많으셨습니다! 서비스 로직에 필요했던 부분들이 잘 채워진 것 같습니다. LearningRepository 쪽 조회 메서드는 조건이 많아서 나중에 리팩토링할 때 복합 인덱스 걸어두는 것도 같이 고려해 보면 좋을 것 같습니다!
📍 개요
⛓️💥 관련 이슈
🛠️ 작업 내용
LearningRepository/PlayingExampleRepository에 조회 메서드 추가,LearningErrorStatus에 에러코드 2개(LEARNING_400_02,LEARNING_404_03) 추가GET /api/learnings/theory(학습 주제 전체보기, difficulty 필수) 구현GET /api/learnings/{learningId}/steps/{learningStepId}/practice-data(단계별 연습 실행 정보 조회) 구현is_active=false인 학습을 존재하지 않는 학습과 동일하게 404 처리saveLearningResult,getLearningProgress) 포함해컨트롤러 전체에 Swagger
@Operation/@Tag문서 추가🔥 리뷰 요청 사항
difficulty쿼리 파라미터를@RequestParam(required=false)로 받고 서비스에서 직접 검증하는 방식(누락 시MissingServletRequestParameterException으로 500 떨어지는 걸 피하려는 의도)이 적절한지practice-dataAPI는 명세상 유저 존재 확인(USER_404_01)이 없어서 안 넣었는데, 이 판단이 맞는지LearningStep이 다른learningId에 속한 경우 기존validateBelongsTo()(400)를 재사용하지 않고 GET API에서만LEARNING_STEP_NOT_FOUND(404)로 별도 처리한 것(POST 저장 API와 의도적으로 다른 시맨틱)✅ 체크리스트
📎 참고 사항
진행률 계산 로직을 공유하는 것들끼리 묶어서 후속 PR 2개로 이어집니다.
Summary by CodeRabbit
새로운 기능
버그 수정