Skip to content

Commit

Permalink
add: 학생의 인증제를 검증하는 UseCase 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
Huuuunee committed Jul 9, 2024
1 parent 3b6fbe7 commit 5e34f5b
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package team.msg.sms.domain.authentication.usecase

import team.msg.sms.common.annotation.ReadOnlyUseCase
import team.msg.sms.domain.authentication.dto.res.QueryAuthenticationVerifyResponseData
import team.msg.sms.domain.authentication.model.MarkingBoardType
import team.msg.sms.domain.authentication.service.MarkingBoardService
import team.msg.sms.domain.student.service.StudentService

@ReadOnlyUseCase
class QueryAuthenticationVerifyUseCase(
private val studentService: StudentService,
private val markingBoardService: MarkingBoardService
) {
fun execute(): QueryAuthenticationVerifyResponseData {
val student = studentService.currentStudent()
val markingBoard = markingBoardService.verifyMarkingBoardByStudentId(student.id)

return if (markingBoard == null) {
QueryAuthenticationVerifyResponseData(
name = student.name,
score = 0.0,
grader = null,
markingBoardType = MarkingBoardType.NOT_SUBMITTED
)
} else {
QueryAuthenticationVerifyResponseData(
name = student.name,
score = markingBoard.totalScore,
grader = markingBoard.graderName,
markingBoardType = markingBoard.markingBoardType
)
}

}
}

0 comments on commit 5e34f5b

Please sign in to comment.