diff --git a/core/src/main/kotlin/common/exception/ErrorType.kt b/core/src/main/kotlin/common/exception/ErrorType.kt index c781b425..0a15637f 100644 --- a/core/src/main/kotlin/common/exception/ErrorType.kt +++ b/core/src/main/kotlin/common/exception/ErrorType.kt @@ -71,6 +71,7 @@ enum class ErrorType( "현재 일시 중단된 기능입니다. 자세한 내용은 알림을 참고해 주세요.", "현재 일시 중단된 기능입니다. 자세한 내용은 알림을 참고해 주세요.", ), + DIARY_QUESTION_INVALID(HttpStatus.BAD_REQUEST, 40026, "강의 일기장 질문이 유효하지 않습니다", "강의 일기장 질문이 유효하지 않습니다"), SOCIAL_CONNECT_FAIL(HttpStatus.UNAUTHORIZED, 40100, "소셜 로그인에 실패했습니다", "소셜 로그인에 실패했습니다"), INVALID_APPLE_LOGIN_TOKEN(HttpStatus.UNAUTHORIZED, 40101, "유효하지 않은 애플 로그인 토큰입니다", "소셜 로그인에 실패했습니다"), diff --git a/core/src/main/kotlin/common/exception/SnuttException.kt b/core/src/main/kotlin/common/exception/SnuttException.kt index 6a8cf9c5..e4cc8259 100644 --- a/core/src/main/kotlin/common/exception/SnuttException.kt +++ b/core/src/main/kotlin/common/exception/SnuttException.kt @@ -135,6 +135,8 @@ object SocialProviderNotAttachedException : SnuttException(ErrorType.SOCIAL_PROV object DiaryQuestionNotFoundException : SnuttException(ErrorType.DIARY_QUESTION_NOT_FOUND) +object DiaryQuestionInvalidException : SnuttException(ErrorType.DIARY_QUESTION_INVALID) + object DiaryDailyClassTypeNotFoundException : SnuttException(ErrorType.DIARY_DAILY_CLASS_TYPE_NOT_FOUND) object DiarySubmissionNotFoundException : SnuttException(ErrorType.DIARY_SUBMISSION_NOT_FOUND) diff --git a/core/src/main/kotlin/diary/service/DiaryService.kt b/core/src/main/kotlin/diary/service/DiaryService.kt index 2c3892cd..72e0f131 100644 --- a/core/src/main/kotlin/diary/service/DiaryService.kt +++ b/core/src/main/kotlin/diary/service/DiaryService.kt @@ -2,6 +2,7 @@ package com.wafflestudio.snutt.diary.service import com.wafflestudio.snutt.common.enums.Semester import com.wafflestudio.snutt.common.exception.DiaryDailyClassTypeNotFoundException +import com.wafflestudio.snutt.common.exception.DiaryQuestionInvalidException import com.wafflestudio.snutt.common.exception.DiaryQuestionNotFoundException import com.wafflestudio.snutt.common.exception.DiarySubmissionNotFoundException import com.wafflestudio.snutt.common.exception.LectureNotFoundException @@ -206,6 +207,9 @@ class DiaryServiceImpl( if (targetDailyClassTypeIds.size != request.targetDailyClassTypes.size) { throw DiaryDailyClassTypeNotFoundException } + if (request.answers.size != request.shortAnswers.size) { + throw DiaryQuestionInvalidException + } val question = DiaryQuestion( answers = request.answers,