Skip to content

T-12 공개 응답에 커리큘럼 결합 - #66

Open
ff1451 wants to merge 1 commit into
feat/t11-curriculum-treefrom
feat/t12-public-curriculum
Open

T-12 공개 응답에 커리큘럼 결합#66
ff1451 wants to merge 1 commit into
feat/t11-curriculum-treefrom
feat/t12-public-curriculum

Conversation

@ff1451

@ff1451 ff1451 commented Aug 19, 2026

Copy link
Copy Markdown

Refs #24
Base: feat/t11-curriculum-tree (#65)

GET /v1/tracks/{slug}curriculum 필드를 추가한다.

변경

  • CurriculumQueryService(신규, curriculum 패키지) — track.TrackService가 curriculum의 리포지토리를 직접 참조하지 않고 이 서비스 하나를 통해서만 커리큘럼을 조회하게 했다. 도메인 경계를 리포지토리가 아니라 서비스 레이어에서 넘는다.
  • N+1 방지: 관리자용 3단 트리 조회(T-11)는 편집 화면 트래픽이라 N+1을 감수했지만, 이건 홈페이지 빌드가 매번 호출하는 공개 경로라 트리 깊이와 무관하게 쿼리 3개(주차 1 + 토픽 IN절 배치 1 + 세부항목 IN절 배치 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) 확인.

덮지 못한 것

쿼리 개수가 트리 깊이와 무관하게 3개로 고정된다는 설계는 코드 구조로 보장했지만(서비스 Javadoc에 근거를 남겼다), 실제 쿼리 횟수를 세는 테스트는 작성하지 않았다 — Hibernate statistics 설정 등 추가 인프라가 필요해서, 이번 범위에서는 설계 검토와 코드 리딩으로 대신했다.

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
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a2112400-dc86-4711-92d4-49ef6a396ce2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant