diff --git a/entity/src/main/kotlin/com/mashup/dojo/PickRepository.kt b/entity/src/main/kotlin/com/mashup/dojo/PickRepository.kt index 8ec01394..6027ffb1 100644 --- a/entity/src/main/kotlin/com/mashup/dojo/PickRepository.kt +++ b/entity/src/main/kotlin/com/mashup/dojo/PickRepository.kt @@ -62,6 +62,11 @@ interface PickRepositoryCustom { ): Long fun findPickCountByMemberId(memberId: String): Long + + fun findSolvedPick( + memberId: String, + questionSetId: String, + ): List } class PickRepositoryImpl( @@ -168,6 +173,21 @@ class PickRepositoryImpl( ) .fetchOne() ?: 0 } + + override fun findSolvedPick( + memberId: String, + questionSetId: String, + ): List { + val pickEntity = QPickEntity.pickEntity + + return jpaQueryFactory + .selectFrom(pickEntity) + .where( + pickEntity.questionSetId.eq(questionSetId), + pickEntity.pickerId.eq(memberId) + ) + .fetch() + } } data class PickEntityMapper diff --git a/service/src/main/kotlin/com/mashup/dojo/service/DefaultPickService.kt b/service/src/main/kotlin/com/mashup/dojo/service/DefaultPickService.kt index 99587089..1c560a54 100644 --- a/service/src/main/kotlin/com/mashup/dojo/service/DefaultPickService.kt +++ b/service/src/main/kotlin/com/mashup/dojo/service/DefaultPickService.kt @@ -112,7 +112,8 @@ class DefaultPickService( pickerMemberId: MemberId, questionSetId: QuestionSetId, ): List { - TODO("Not yet implemented") + return pickRepository.findSolvedPick(pickerMemberId.value, questionSetId.value) + .map { it.toPick() } } @Transactional diff --git a/service/src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt b/service/src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt index 13c1cf13..e4b8ad5c 100644 --- a/service/src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt +++ b/service/src/main/kotlin/com/mashup/dojo/usecase/QuestionUseCase.kt @@ -126,7 +126,6 @@ class DefaultQuestionUseCase( override fun getQuestionSheetList(memberId: MemberId): QuestionUseCase.GetQuestionSheetsResult { return TEMP_GET_QUESTION_SHEETS_RESULT // 운영중인 questionSet 조회 (todo : scheduler 가 최신 QuestionSet 을 발행 시각 2분전에 publishedYn Y 로 변경 예정) - // todo : qSet / val operatingQSet = questionService.getOperatingQuestionSet() ?: throw DojoException.of(DojoExceptionType.QUESTION_SET_OPERATING_NOT_EXIST) @@ -134,7 +133,6 @@ class DefaultQuestionUseCase( val questionIds = operatingQSet.questionIds.map { it.questionId } // QuestionSetId & solverId 를 통해 현재 운영중인 QuestionSet 에서 푼 문제가 어디까지 인지 확인 - // todo : Pick 정보에 QuestionSetId 필요함 (QuestionSet 이 없는 경우, 동일 질문 다른 후보자에 대한 정보와 분간 X) val solvedQuestionIds = pickService.getSolvedPickList(memberId, operatingQSet.id) .map { it.questionId }