-
Notifications
You must be signed in to change notification settings - Fork 0
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
The head ref may contain hidden characters: "feat/#63-\uD50C\uB808\uC774\uC5B4\uAC00\uC0DD\uC131\uD55C\uD034\uC988\uBAA9\uB85D\uC870\uD68C"
Conversation
- 퀴즈 조회 시 사용할 필터로 CREATED(생성한 문제), ATTEMPTED(시도한 문제), CORRECT(정답을 맞춘 문제)를 추가했습니다. - 등록된 필터를 기준으로 퀴즈를 조회할 수 있습니다.
- QuizFilterFactory를 사용하여 CREATED와 ATTEMPTED 필터 타입에 따라 필터를 분류하고 처리합니다. - 등록되지 않은 필터 타입에 대해 커스텀 에러를 반환합니다.
- 플레이어가 생성한 퀴즈 목록을 조회하는 기능을 구현했습니다. - 게임 방에서 플레이어가 시도한(풀었던 문제 + 풀지 못했던 문제) 퀴즈 목록을 조회하는 기능을 구현했습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다!! 이름 작명은 항상 어려운 것 같아요..저도
@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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@query문을 아래 처럼 보기좋게 정렬하면 좋을 것 같아요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 보기좋게 정렬해보겠습니다!😀
return when (QuizFilterType.create(quizFilterType)) { | ||
QuizFilterType.CREATED -> CreatedQuizFilter(quizRepository) | ||
QuizFilterType.ATTEMPTED -> AttemptedQuizFilter(quizRepository) | ||
else -> throw BaseException(BaseErrorCode.QUIZ_FILTER_INVALID) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코틀린 when 문법으로 깔끔하게 작성하신게 인상깊네요!!
나중에 여러 종류의 필터타입등이 많이 추가될 수 도 있을 것 같은데, 이런 동적으로 받을 수 있는 쿼리스프링 타입에 대해서 어떻게 조회해야될지 고민해보면 좋을 것 같습니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네! 다음 조회 기능을 구현할 때 같이 논의해보면 좋을 것 같습니다!😆
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 쿼리는 여태까지 시도해봤던 모든 퀴즈 기록들을 조회하는 것인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 맞습니다. 특정 멤버가 시도한 퀴즈 전체를 조회합니다. 조회 쿼리 같은 경우 어떤 테이블을 조합해서 어떤 데이터를 구체적으로 가져오는지 앞으로는 더 명확하게 적도록 하겠습니다. 😂
#️⃣ 관련 이슈
📝 작업한 내용
💬 논의하고 싶은 내용