Skip to content

Commit

Permalink
update : solvedPick impl
Browse files Browse the repository at this point in the history
  • Loading branch information
xonmin committed Aug 10, 2024
1 parent 1d79435 commit a5cd840
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
20 changes: 20 additions & 0 deletions entity/src/main/kotlin/com/mashup/dojo/PickRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ interface PickRepositoryCustom {
): Long

fun findPickCountByMemberId(memberId: String): Long

fun findSolvedPick(
memberId: String,
questionSetId: String,
): List<PickEntity>
}

class PickRepositoryImpl(
Expand Down Expand Up @@ -168,6 +173,21 @@ class PickRepositoryImpl(
)
.fetchOne() ?: 0
}

override fun findSolvedPick(
memberId: String,
questionSetId: String,
): List<PickEntity> {
val pickEntity = QPickEntity.pickEntity

return jpaQueryFactory
.selectFrom(pickEntity)
.where(
pickEntity.questionSetId.eq(questionSetId),
pickEntity.pickerId.eq(memberId)
)
.fetch()
}
}

data class PickEntityMapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class DefaultPickService(
pickerMemberId: MemberId,
questionSetId: QuestionSetId,
): List<Pick> {
TODO("Not yet implemented")
return pickRepository.findSolvedPick(pickerMemberId.value, questionSetId.value)
.map { it.toPick() }
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,13 @@ 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)

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 }
Expand Down

0 comments on commit a5cd840

Please sign in to comment.