Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 특정 플레이어의 퀴즈 목록 조회 #65

Merged

Conversation

youjungHwang
Copy link
Member

#️⃣ 관련 이슈

📝 작업한 내용

  • 플레이어가 생성한 퀴즈 목록을 조회하는 기능을 구현했습니다.
  • 게임 방에서 플레이어가 시도한(풀었던 문제 + 풀지 못했던 문제) 퀴즈 목록을 조회하는 기능을 구현했습니다.

💬 논의하고 싶은 내용

  • 추후 퀴즈 목록을 조회할 때 다양한 기준으로 필터링할 수 있도록 QuizFilterType을 구현했습니다. 관련해서 필터링 하는 부분을 애플리케이션 단의 포트에 작성했습니다. 아키텍처 상에서 수정이 필요한 부분이나, 더 이해하기 쉽고 확장성 있게 리팩토링할 방법이 있다면 말씀주세요, 적극 반영하겠습니다.😀😀
  • 메서드명과 클래스명을 정하는 데 어려움이 있었습니다. 좀 더 이해하기 쉬운 이름이 있다면 추천해 주시면 감사하겠습니다.😂😂

- 퀴즈 조회 시 사용할 필터로 CREATED(생성한 문제), ATTEMPTED(시도한 문제), CORRECT(정답을 맞춘 문제)를 추가했습니다.
- 등록된 필터를 기준으로 퀴즈를 조회할 수 있습니다.
- QuizFilterFactory를 사용하여 CREATED와 ATTEMPTED 필터 타입에 따라 필터를 분류하고 처리합니다.
- 등록되지 않은 필터 타입에 대해 커스텀 에러를 반환합니다.
- 플레이어가 생성한 퀴즈 목록을 조회하는 기능을 구현했습니다.
- 게임 방에서 플레이어가 시도한(풀었던 문제 + 풀지 못했던 문제) 퀴즈 목록을 조회하는 기능을 구현했습니다.
@youjungHwang youjungHwang added 🚀 BE 우리는 백엔드 개발자! ✨ Feature 기능개발 가자! 💯 Test 테스트를 작성해보자! labels Sep 2, 2024
@youjungHwang youjungHwang self-assigned this Sep 2, 2024
@youjungHwang youjungHwang linked an issue Sep 2, 2024 that may be closed by this pull request
2 tasks
Copy link
Contributor

@Jeongjjuna Jeongjjuna left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!! 이름 작명은 항상 어려운 것 같아요..저도

Comment on lines +30 to +31
@Query("SELECT q FROM QuizEntity q WHERE q.deletedAt IS NULL AND q.writerId = :memberId")
fun findAllCreatedByMember(@Param("memberId") writerId: Long, pageable: Pageable): Page<QuizEntity>
Copy link
Contributor

Choose a reason for hiding this comment

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

@query문을 아래 처럼 보기좋게 정렬하면 좋을 것 같아요!!

Copy link
Member Author

Choose a reason for hiding this comment

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

네 보기좋게 정렬해보겠습니다!😀

Comment on lines +14 to +18
return when (QuizFilterType.create(quizFilterType)) {
QuizFilterType.CREATED -> CreatedQuizFilter(quizRepository)
QuizFilterType.ATTEMPTED -> AttemptedQuizFilter(quizRepository)
else -> throw BaseException(BaseErrorCode.QUIZ_FILTER_INVALID)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

코틀린 when 문법으로 깔끔하게 작성하신게 인상깊네요!!
나중에 여러 종류의 필터타입등이 많이 추가될 수 도 있을 것 같은데, 이런 동적으로 받을 수 있는 쿼리스프링 타입에 대해서 어떻게 조회해야될지 고민해보면 좋을 것 같습니다!!

Copy link
Member Author

Choose a reason for hiding this comment

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

네! 다음 조회 기능을 구현할 때 같이 논의해보면 좋을 것 같습니다!😆

Comment on lines +35 to +43
SELECT q.*
FROM quiz q
WHERE q.deleted_at IS NULL
AND q.quiz_id IN (
SELECT gq.quiz_id
FROM game_quiz gq
JOIN member_game_result mgr ON mgr.game_id = gq.game_id
WHERE mgr.member_id = :memberId
AND mgr.total_count > 0
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
Member Author

Choose a reason for hiding this comment

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

네 맞습니다. 특정 멤버가 시도한 퀴즈 전체를 조회합니다. 조회 쿼리 같은 경우 어떤 테이블을 조합해서 어떤 데이터를 구체적으로 가져오는지 앞으로는 더 명확하게 적도록 하겠습니다. 😂

@youjungHwang youjungHwang merged commit fe9484f into develop Sep 2, 2024
1 check passed
@youjungHwang youjungHwang deleted the feat/#63-플레이어가생성한퀴즈목록조회 branch September 2, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 BE 우리는 백엔드 개발자! ✨ Feature 기능개발 가자! 💯 Test 테스트를 작성해보자!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: 특정 플레이어의 퀴즈 목록 조회
2 participants