From d395ba707070fe8a89402dd8992842ea55d72d20 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:28:46 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT]=20=EC=B2=A8=EC=82=AD=20=EC=9C=A0?= =?UTF-8?q?=EB=AC=B4=20=EA=B2=80=EC=A6=9D=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index c3abb44..2fd053e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -40,9 +40,7 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx UniversityExam universityExam = getUniversityExam(universityExamId); UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); - if(universityExamRecord.getExamRecordResultFileName() == null){ - throw new UniversityExamRecordException(INVALID_UNIVERSITY_EXAM_RECORD_RESULT_FILE_NAME); - } + validateCorrection(universityExamRecord); String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); @@ -57,12 +55,20 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long UniversityExam universityExam = getUniversityExam(universityExamId); UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); + validateCorrection(universityExamRecord); + String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); return UniversityExamRecordResultResponseDTO.of(resultUrl); } + private void validateCorrection(UniversityExamRecord universityExamRecord) { + if(universityExamRecord.getExamRecordResultFileName() == null){ + throw new UniversityExamRecordException(INVALID_UNIVERSITY_EXAM_RECORD_RESULT_FILE_NAME); + } + } + @Transactional public UniversityExamRecordIdResponse createUniversityExamRecord( CreateUniversityExamRequestDTO request, Member member) {