Skip to content

Comments

[FEAT] 최근 대회 하단 카드 전용 요약 API 추가#427

Merged
Jin409 merged 5 commits intomainfrom
feat/league-recent-summary
Feb 11, 2026
Merged

[FEAT] 최근 대회 하단 카드 전용 요약 API 추가#427
Jin409 merged 5 commits intomainfrom
feat/league-recent-summary

Conversation

@TAEW00KIM
Copy link
Contributor

이슈 배경

기존의 문제

  • 하단 카드에 필요한 데이터가 API 단위로 분리

해결 방식

  • 하단 카드 전용 Query API 추가 GET /leagues/recent-summary
  • 응답에서 records(대회 기록) + topScorers(득점왕)를 한 번에 내려줄 수 있도록 수정
  • Controller/Service/Acceptance 테스트를 보강하고 REST Docs를 최신화했어요.

확인해야 할 부분

  • 하단 카드 요구사항 기준으로 응답 필드(records, topScorers)가 충분한지
  • recordLimit, topScorerLimit 파라미터 기본값/사용 방식이 프론트 요구와 맞는지
  • 기존 REST Docs warning(기존 누락 스니펫)과 별개로 신규 API 문서는 정상 반영됐는지

@TAEW00KIM TAEW00KIM requested a review from Jin409 February 10, 2026 07:58
@TAEW00KIM TAEW00KIM self-assigned this Feb 10, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @TAEW00KIM, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 Pull Request는 프론트엔드 하단 카드에서 필요한 대회 기록과 득점왕 정보를 효율적으로 가져올 수 있도록 새로운 통합 API를 도입합니다. 기존에는 여러 API를 호출해야 했던 비효율성을 개선하여, 단일 요청으로 필요한 모든 데이터를 제공함으로써 프론트엔드의 데이터 로딩 과정을 간소화하고 성능을 향상시키는 것을 목표로 합니다. 또한, 코드 품질 향상을 위해 Jacoco를 통한 코드 커버리지 측정 환경을 구축하고, 새로운 기능에 대한 철저한 테스트와 문서화를 완료했습니다.

Highlights

  • 새로운 API 엔드포인트 추가: 프론트엔드 하단 카드에 필요한 대회 기록과 득점왕 정보를 한 번에 제공하는 /leagues/recent-summary API 엔드포인트가 추가되었습니다.
  • 데이터 통합 및 효율화: 기존에 분리되어 있던 API 호출을 통합하여, records(대회 기록)와 topScorers(득점왕) 데이터를 단일 응답으로 제공하도록 개선되었습니다.
  • 코드 커버리지 도구 Jacoco 추가: 빌드 스크립트에 Jacoco 플러그인을 추가하여 코드 커버리지 측정을 위한 기반을 마련했습니다.
  • REST Docs 최신화 및 테스트 보강: 새로 추가된 API에 대한 REST Docs 문서가 최신화되었으며, Controller, Service, Acceptance 테스트가 보강되었습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • build.gradle
    • Jacoco 플러그인 및 관련 설정을 추가하여 코드 커버리지 측정을 활성화했습니다.
  • src/docs/asciidoc/api.adoc
    • 새로운 '최근 대회 요약 정보 조회' API에 대한 AsciiDoc 문서를 추가했습니다.
  • src/main/java/com/sports/server/query/application/LeagueQueryService.java
    • 최근 대회 요약 정보를 조회하는 findRecentSummary 메서드를 구현했습니다. 이 메서드는 주어진 연도와 제한에 따라 대회 기록과 득점왕 목록을 반환합니다.
  • src/main/java/com/sports/server/query/dto/response/LeagueRecentSummaryResponse.java
    • 최근 대회 요약 정보를 담는 LeagueRecentSummaryResponse 레코드 DTO를 새로 추가했습니다. 이 DTO는 LeagueRecordTopScorerResponse 목록을 포함합니다.
  • src/main/java/com/sports/server/query/presentation/LeagueQueryController.java
    • 최근 대회 요약 정보를 조회하는 /leagues/recent-summary GET 엔드포인트를 추가했습니다. 이 엔드포인트는 year, recordLimit, topScorerLimit 파라미터를 받습니다.
  • src/main/resources/static/docs/api.html
    • 생성된 API 문서(api.html)에 '최근 대회 요약 정보 조회' 섹션이 추가되고, 문서 업데이트 날짜가 최신화되었습니다.
  • src/test/java/com/sports/server/query/acceptance/LeagueQueryAcceptanceTest.java
    • 새로운 '최근 대회 요약 정보 조회' API에 대한 인수 테스트 케이스를 추가하여 엔드포인트의 동작을 검증했습니다.
  • src/test/java/com/sports/server/query/application/LeagueQueryServiceTest.java
    • 새로운 findRecentSummary 서비스 메서드에 대한 단위 테스트 케이스를 추가하여 비즈니스 로직의 정확성을 검증했습니다.
  • src/test/java/com/sports/server/query/presentation/LeagueQueryControllerTest.java
    • 새로운 '최근 대회 요약 정보 조회' 컨트롤러 엔드포인트에 대한 통합 테스트 및 REST Docs 스니펫 생성 로직을 추가했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

안녕하세요. 최근 대회 요약 정보를 제공하는 API 추가 작업을 리뷰했습니다. 전반적으로 새로운 기능에 대한 구현과 테스트, 문서화가 꼼꼼하게 잘 이루어졌습니다. 한 가지 성능 개선을 위한 제안을 LeagueQueryService.java 파일에 남겼습니다. 확인 부탁드립니다.

Comment on lines 66 to 79
public LeagueRecentSummaryResponse findRecentSummary(Integer year, Integer recordLimit, Integer topScorerLimit) {
int safeRecordLimit = Math.max(recordLimit, 0);
int safeTopScorerLimit = Math.max(topScorerLimit, 0);

List<LeagueRecentSummaryResponse.LeagueRecord> records = findLeagues(new LeagueQueryRequestDto(year, LeagueProgress.FINISHED)).stream()
.filter(league -> league.winnerTeamName() != null)
.limit(safeRecordLimit)
.map(LeagueRecentSummaryResponse.LeagueRecord::from)
.toList();

List<TopScorerResponse> topScorers = findTopScorersByYear(year, safeTopScorerLimit);

return new LeagueRecentSummaryResponse(records, topScorers);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

현재 구현은 특정 연도의 모든 종료된 리그를 조회한 후, 메모리에서 필터링하고 제한하고 있습니다. 리그 수가 많아질 경우 성능 저하가 발생할 수 있습니다.

데이터베이스 수준에서 필터링과 제한을 적용하는 것이 더 효율적입니다. LeagueQueryRepositoryPageable을 인자로 받아 필요한 만큼의 데이터만 조회하는 새로운 메소드를 추가하는 것을 고려해보세요.

예를 들어, 다음과 같은 메소드를 추가할 수 있습니다.

// In LeagueQueryRepository.java
List<League> findRecentFinishedLeagues(Integer year, Pageable pageable);

이 메소드는 yearLeagueProgress.FINISHED로 리그를 필터링하고, 우승팀이 있는 리그만 조회하며, Pageable을 통해 결과를 제한해야 합니다. 이렇게 하면 서비스 레이어의 코드가 더 간결해지고 성능도 향상될 것입니다.

Copy link
Contributor

@Jin409 Jin409 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨어요 👍

@@ -182,6 +182,10 @@ operation::league-query-controller-test/리그_득점왕을_조회한다[snippet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • PR 본문에 화면 캡처본이 추가되면 더 좋을 것 같아요!
  • PR 본문에 확인해야 할 부분 이 대부분 프론트와의 소통이 필요한 부분인 것 같아서, 명세의 경우에는 따로 논의하신 뒤에 리뷰 요청 주셔도 좋을 것 같아요! 물론 항상 그래야 한다는 것은 아닙니닷. 다만 명세가 달라져야 하면 두 번 일을 하게 될 수도 있으니.. ㅎㅎ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵넵 참고하겠습니다!

int safeRecordLimit = Math.max(recordLimit, 0);
int safeTopScorerLimit = Math.max(topScorerLimit, 0);

List<LeagueRecentSummaryResponse.LeagueRecord> records = findLeagues(new LeagueQueryRequestDto(year, LeagueProgress.FINISHED)).stream()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꼭 수정해야 하는 것은 아니고,
보다 보니까 떠오르는 생각인데 간접적으로 다른 API 와 의존도가 높아지는 방향으로의 구현이 아닐까 하는 생각이 들어요.

예시 상황

  • /leagues 에서의 API 명세가 변경됨
  • 그로 인해 현재 요약 관련 API 에는 필요한 필드가 제거됨

서로 다른 API 가 의존도를 갖는 방향이 위험할 수도 있겠다는 생각도 들어요!

태우님 의견은 어떠신가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 좋은 의견인 것 같습니다. recent-summary api 전용 dto로 분리하는 방안 고려해서 다시 커밋하겠습니다
수정하는 게 나을 것 같아요 지금 보니까

Comment on lines +109 to +121
jacoco {
toolVersion = "0.8.12"
}

jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
csv.required = false
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요건 왜 바뀐건가요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./gradlew test jacocoTestReport
저렇게 수정해야 이 명령어가 돌아가서 바꿨습니다!
xml/html 리포트 생성만 보장하는 변경이고, 런타임 기능에는 영향 없습니다

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오! 태우님이 자코코 추가하고 싶으셔서 추가하신 건가요?
기존 동작에는 딱히 없던 것으로 보여서.. 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네네 온보딩할 때 테스트 방식에 자코코도 있더라구요! 그래서 한번 추가해봤습니다

int safeRecordLimit = Math.max(recordLimit, 0);
int safeTopScorerLimit = Math.max(topScorerLimit, 0);

List<LeagueRecentSummaryResponse.LeagueRecord> records = findLeagues(new LeagueQueryRequestDto(year, LeagueProgress.FINISHED)).stream()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기존의 의도는 메서드에 대해서도 마찬가지이긴 했어요!

findLeagues 도 사실상 /leagues 조회에서 사용 되고 있기에,
간접적으로 현재 API 의 구현이 /leagues 의 조회에 간접적으로 의존하는 건 아닐까요?

findLeagues(new LeagueQueryRequestDto(year, LeagueProgress.FINISHED)
현재 이 구현부 역시도, /leagues 에서의 request dto 가 바뀌면 같이 영향을 받는 부분이 아닐까요?

만약 동일한 기능을 재사용할 것으로 보인다면, public 메서드로 열려 있는 메서드를 그대로 호출하는 것이 아니라 동일한 기능을 하는 부분을 메서드로 뽑아 내는 게 안전하지 않을까 싶었어요

그리고 현재 정도의 기능은 사실상, 특성 명세에 의존되는 메서드를 호출하는 게 아니라 레포지토리 단에서의 호출로도 충분할 것 같아요. 그러면 이 코멘트에서의 성능 이슈도 해결될 듯 보이네요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했습니다!

@Jin409 Jin409 merged commit e2dde19 into main Feb 11, 2026
1 check passed
@Jin409 Jin409 deleted the feat/league-recent-summary branch February 11, 2026 12:18
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.

2 participants