Skip to content

Commit

Permalink
[FEAT] 첨삭 유무 검증 메서드 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekks committed Jan 16, 2024
1 parent dcbf82f commit d395ba7
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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) {
Expand Down

0 comments on commit d395ba7

Please sign in to comment.