Merge branch 'be/lecture' into 'backend'

feat: quiz, lecture 이미지 등록시 파일 형식 확인

See merge request s11-webmobile1-sub2/S11P12A701!173
This commit is contained in:
박정민 2024-08-12 13:41:24 +09:00
commit 3d1436ad47
2 changed files with 16 additions and 0 deletions

View File

@ -36,6 +36,10 @@ public class LectureController {
return new ResponseEntity<>(HttpStatus.CONFLICT);
}
if (!image.isEmpty() && !image.getContentType().startsWith("image")) {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
lectureService.createLecture(userId, lectureCreateRequest, image);
return new ResponseEntity<>(HttpStatus.CREATED);

View File

@ -38,6 +38,12 @@ public class QuizController {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
for (MultipartFile image : images) {
if (!image.isEmpty() && !image.getContentType().startsWith("image")) {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
QuizSet quizSet = quizSetService.createQuizSet(userId, quizSetCreateRequest.getTitle());
int imageIdx = 0;
@ -81,6 +87,12 @@ public class QuizController {
return new ResponseEntity<>(HttpStatus.CONFLICT);
}
for (MultipartFile image : images) {
if (!image.isEmpty() && !image.getContentType().startsWith("image")) {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
quizSetService.updateQuizSet(quizSetUpdateRequest.getId(), quizSetUpdateRequest.getTitle());
Map<Long, Boolean> quizUpdatedCheckMap = new HashMap<>();