Skip to content

Conversation

@dlsrks1021
Copy link
Collaborator

🛰️ Issue Number

🪐 작업 내용

  • service 계층에 transactional을 빼먹다니
  • 닉네임을 통해 랭킹을 조회
    1. nickname을 통해 score를 확인합니다.
    2. score의 페이지 위치를 확인 및 pageable을 생성합니다.
    3. pageable을 통해 페이지를 조회해 결과를 반환합니다.

native query를 사용하면 1-2번 과정의 통합이 가능하지만, 아래와 같은 이유로 native query를 사용하지 않았습니다.

  • 테스트 코드에서는 user 테이블이 user_test 테이블로 이름이 변경되기 때문에 native query 사용 시 user 테이블 참조가 불가능합니다.
  • MySQL에 종속된 쿼리 사용 시 Redis로의 전환에서 다시 수정이 필요할 수 있습니다.

위 일련의 과정에 대해서는 Redis 리팩토링 시에 효율적인 방법을 찾아보도록 하겠습니다.

📚 Reference

✅ Check List

  • 코드가 정상적으로 컴파일되나요?
  • 테스트 코드를 통과했나요?
  • merge할 브랜치의 위치를 확인했나요?
  • Label을 지정했나요?

@dlsrks1021 dlsrks1021 self-assigned this Jul 19, 2025
@dlsrks1021 dlsrks1021 added the enhancement New feature or request label Jul 19, 2025
@dlsrks1021 dlsrks1021 linked an issue Jul 19, 2025 that may be closed by this pull request
@Query("SELECT s.score FROM Stat s WHERE s.user.nickname = :nickname")
Optional<Long> findScoreByNickname(String nickname);

long countByScoreGreaterThan(Long score);
Copy link
Collaborator

Choose a reason for hiding this comment

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

이런것도 있군요?,? 하나 배워갑니다 .. 🙂

FROM
Stat s JOIN s.user u
""")
Page<StatWithNickname> findWithUser(Pageable pageable);
Copy link
Collaborator

Choose a reason for hiding this comment

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

이런 커스텀 쿼리메소드는 jpa와 달리 findAllStatsWithUser 이런식으로 대상을 확실히 표시해주는건 어떨까 싶습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

좋은 의견 감사합니다!
항상 메서드 명을 정하는 게 어려운 것 같아요,,
수정 반영하겠습니다!

Copy link
Collaborator

@sehee123 sehee123 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!
저도 dbRider 테스트 적용 부분 얼른 따라해봐야겠네요 👀

Copy link
Collaborator

@jiwon1217 jiwon1217 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 !

Copy link
Collaborator

@LimKangHyun LimKangHyun left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

@dlsrks1021 dlsrks1021 merged commit 20f6d46 into dev Jul 21, 2025
2 checks passed
@dlsrks1021 dlsrks1021 deleted the feat/89 branch July 21, 2025 03:36
Copy link
Collaborator

@silver-eunjoo silver-eunjoo left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 유저 닉네임을 통해 랭킹 조회

6 participants