T-12 공개 응답에 커리큘럼 결합 - #66
Open
ff1451 wants to merge 1 commit into
Open
Conversation
GET /v1/tracks/{slug}에 curriculum 필드를 추가한다. 공개 세트가 없으면 null,
있으면 트리 깊이와 무관하게 쿼리 3개(주차/토픽/세부항목 각 1회, IN 절 배치
조회)로 조립한다.
- CurriculumQueryService(신규) — track.TrackService가 curriculum 패키지의
리포지토리를 직접 참조하지 않고 이 서비스를 통해서만 커리큘럼을 조회한다
(도메인 경계를 리포지토리가 아니라 서비스로 넘는다)
- 관리자용 3단 트리 조회(T-11, GET /v1/admin/curriculums/{id})는 N+1을
감수했지만, 이건 홈페이지 빌드가 매번 호출하는 공개 경로라 명시적으로
피했다 — 배치 조회 후 Collectors.groupingBy로 메모리에서 트리를 조립한다.
groupingBy는 인코운터 순서를 그룹 내에서 보존하므로, 세 쿼리를 각각
display_order로 정렬해서 가져오면 재조립된 트리도 순서가 맞는다
- AC-2.7(토픽 0개인 주차 제외)은 조립 마지막 단계에서 필터링
테스트: PublicCurriculumIntegrationTest(신규) —
- AC-2.2 공개 세트 없으면 curriculum 필드 자체가 없음(null), 500 아님
- AC-2.4 weekFrom/weekTo를 그대로 반환 (라벨 문자열은 서버가 만들지 않는다)
- AC-2.7 토픽 0개인 주차 제외
- 비공개 세트는 노출되지 않음
./gradlew test 3회 연속 전체 통과(71개, 실패 0).
Refs #24
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #24
Base:
feat/t11-curriculum-tree(#65)GET /v1/tracks/{slug}에curriculum필드를 추가한다.변경
CurriculumQueryService(신규, curriculum 패키지) —track.TrackService가 curriculum의 리포지토리를 직접 참조하지 않고 이 서비스 하나를 통해서만 커리큘럼을 조회하게 했다. 도메인 경계를 리포지토리가 아니라 서비스 레이어에서 넘는다.Collectors.groupingBy로 메모리에서 재조립한다 —groupingBy가 그룹 내 인코운터 순서를 보존하므로, 세 쿼리를 각각display_order로 정렬해서 가져오면 재조립된 트리도 순서가 맞는다.테스트
PublicCurriculumIntegrationTest(신규):curriculum필드 자체가 없음(null) — 500이 아니다weekFrom/weekTo를 그대로 반환(라벨 문자열은 서버가 만들지 않는다)./gradlew test를 3회 연속 돌려 전체 통과(71개, 실패 0) 확인.덮지 못한 것
쿼리 개수가 트리 깊이와 무관하게 3개로 고정된다는 설계는 코드 구조로 보장했지만(서비스 Javadoc에 근거를 남겼다), 실제 쿼리 횟수를 세는 테스트는 작성하지 않았다 — Hibernate statistics 설정 등 추가 인프라가 필요해서, 이번 범위에서는 설계 검토와 코드 리딩으로 대신했다.