Skip to content

feat: 명예의 전당 api 구현#849

Draft
nourzoo wants to merge 18 commits intodev-be-archivefrom
feat/830
Draft

feat: 명예의 전당 api 구현#849
nourzoo wants to merge 18 commits intodev-be-archivefrom
feat/830

Conversation

@nourzoo
Copy link
Copy Markdown
Contributor

@nourzoo nourzoo commented Feb 7, 2026

📌 관련 이슈

✨ 변경 내용

  • 명예의 전당 전체 조회 API 추가
  • 컨트롤러: /api/v1/leaderboards GET 추가
  • 서비스: LeaderboardService + 전략 인터페이스 LeaderboardQuery
  • 쿼리 구현:
    • WinFairyLeaderboardQuery: 승리요정 상위 N
    • LoseFairyLeaderboardQuery: 패배요정 상위 N
    • MostCheckInLeaderboardQuery: 최다 직관 상위 N
    • ChattiestLeaderboardQuery: 수다쟁이 상위 N

API 설명

  • 엔드포인트: GET /api/v1/leaderboards
  • 응답 바디 예시:
{
  "leaderboards": [
    {
      "type": "WIN_FAIRY",
      "items": []
    },
    {
      "type": "MOST_CHECK_IN",
      "items": [
        {
          "rank": 1,
          "memberId": 5007,
          "nickname": "기아2",
          "favoriteTeam": "KIA",
          "profileImageUrl": "https://image.com/기아2.png",
          "score": 3
        },
        {
          "rank": 1,
          "memberId": 5008,
          "nickname": "기아3",
          "favoriteTeam": "KIA",
          "profileImageUrl": "https://image.com/기아3.png",
          "score": 3
        },
        {
          "rank": 1,
          "memberId": 5009,
          "nickname": "엘지3",
          "favoriteTeam": "LG",
          "profileImageUrl": "https://image.com/엘지3.png",
          "score": 3
        },
        {
          "rank": 1,
          "memberId": 5010,
          "nickname": "롯데1",
          "favoriteTeam": "롯데",
          "profileImageUrl": "https://image.com/롯데1.png",
          "score": 3
        }
      ]
    },
    {
      "type": "CHATTIEST",
      "items": []
    },
    {
      "type": "LOSE_FAIRY",
      "items": []
    }
  ]
}
  • 동점(공동 순위)일 경우 해당 순위의 모든 사용자를 반환함. (ex 공동 1등이 3명이면 3명 모두 반환)
  • 상태 코드:
    • 정상: 200 OK (현재 구현은 데이터 없음이어도 빈 리스트로 200 반환)

집계 기준

  • WIN_FAIRY/LOSE_FAIRY: victory_fairy_rankings 스코어 기준 상·하위 N
  • MOST_CHECK_IN: 전년도 check_ins 수 기준 상위 N
  • CHATTIEST: 전년도 talks 수 기준 상위 N
    • 제외: 신고된 톡

🎸 기타 참고 사항

  • 스크린샷, 참고 링크, 추가 설명 등 (없으면 생략 가능)

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 7, 2026

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

Run ID: bbdf14e7-454d-4335-ae28-4d028dc62455

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/830

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

@github-actions github-actions Bot added 🐒 BE 백엔드 🐒 🚀 feat 기능 (새로운 기능, 기능 수정) labels Feb 7, 2026
@nourzoo nourzoo changed the title Feat/830 feat: 명예의 전당 api 구현 Feb 7, 2026
@Starlight258
Copy link
Copy Markdown
Contributor

~02.15 : 리뷰

Copy link
Copy Markdown
Member

@bowook bowook left a comment

Choose a reason for hiding this comment

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

🐉
고생하셨습니다!

JOIN teams t ON t.team_id = m.team_id
WHERE r.rnk <= :limit
AND m.deleted_at IS NULL
AND m.team_id IS NOT NULL
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

R: 현재 members 테이블의 필터링 조건(deleted_at, team_id)이 최외곽 SELECT 절에 위치해 있어요!
이 경우, 만약 체크인 횟수 상위 10명을 뽑았는데 그중 탈퇴한 회원이 포함되어 있다면, 최종 결과물은 10개 미만(예: 9개)으로 노출되는 문제가 발생할 수 있을 것 같아요!
의도하신 limit만큼의 데이터를 정확히 보장하려면, member_counts CTE 내부나 조인 시점에서 멤버 필터링을 미리 처리하는 것이 로직의 일관성 측면에서 더 안전해 보입니다.
그래야, 사전에 미리 걸르고 걸러서 limit만큼 안전하게 뽑을 수 있지 않을까요?

Copy link
Copy Markdown
Contributor Author

@nourzoo nourzoo Feb 22, 2026

Choose a reason for hiding this comment

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

피드백 감사합니다! 그런 문제가 있을 수 있겠군요
말씀주신대로 members 필터를 집계 단계(member_counts)로 이동했습니다

@Override
public ResponseEntity<LeaderboardsResponse> findAllTop(final int limit) {
var responses = leaderboardService.findAllTop(limit);
return ResponseEntity.ok(LeaderboardsResponse.of(responses));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A : return 개행 한 줄....

private final List<LeaderboardQuery> queries;

@PostConstruct
void init() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

C: 리더보드 목록들을 관리하는 역할의 객체를 하나 부여하는 것도 좋아보여요! 리더보드서비스가 그 역할까지 하고 있는 것 처럼보입니다.
서비스에서는 비즈니스 로직만 수행하고, Factory같은 것을 도입해서 객체 생성 책임을 부여하면 어떨까요?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LeaderboardQuery 목록 관리, 조회를 LeaderboardQueryRegistry로 분리했고, 서비스에서는 비즈니스 로직만 수행하도록 수정했습니다!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

R: final..

@nourzoo nourzoo requested a review from bowook March 5, 2026 07:17
Copy link
Copy Markdown
Member

@bowook bowook left a comment

Choose a reason for hiding this comment

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

🐉
고생하셨습니다!

.containsExactly(fora.getId(), mint.getId());
}
//
// @DisplayName("승리요정 명예의 전당에서 동점이면 공동 1등이 rank=1로 모두 반환된다 (limit=1이어도).")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A: 이 주석은 검증 안하는 테스트인가요? 그렇다면 지워도 괜찮을 것 같아ㅏ요!

Copy link
Copy Markdown
Contributor

@Starlight258 Starlight258 left a comment

Choose a reason for hiding this comment

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

🐬
고생 많으셨어요 :)

@jjunh0 jjunh0 marked this pull request as draft April 25, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐒 BE 백엔드 🐒 🚀 feat 기능 (새로운 기능, 기능 수정)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants