From 5e34f5bacda670a48110d3cd8f05dc0756491cab Mon Sep 17 00:00:00 2001 From: huuuunee Date: Wed, 10 Jul 2024 02:14:15 +0900 Subject: [PATCH] =?UTF-8?q?add:=20=ED=95=99=EC=83=9D=EC=9D=98=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=EC=A0=9C=EB=A5=BC=20=EA=B2=80=EC=A6=9D=ED=95=98?= =?UTF-8?q?=EB=8A=94=20UseCase=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QueryAuthenticationVerifyUseCase.kt | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/authentication/usecase/QueryAuthenticationVerifyUseCase.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/authentication/usecase/QueryAuthenticationVerifyUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/authentication/usecase/QueryAuthenticationVerifyUseCase.kt new file mode 100644 index 00000000..8b52ac18 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/authentication/usecase/QueryAuthenticationVerifyUseCase.kt @@ -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 + ) + } + + } +} \ No newline at end of file