From a0b363d74f8147886730f69d3ee5ab90ae8d3aef Mon Sep 17 00:00:00 2001 From: kgc91747 Date: Mon, 12 Aug 2024 13:40:18 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20quiz,=20lecture=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EB=93=B1=EB=A1=9D=EC=8B=9C=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=ED=98=95=EC=8B=9D=20=ED=99=95=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lecture/controller/LectureController.java | 4 ++++ .../edufocus/quiz/controller/QuizController.java | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java b/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java index 7ad29a6..dfe142c 100644 --- a/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java +++ b/backend/src/main/java/com/edufocus/edufocus/lecture/controller/LectureController.java @@ -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); diff --git a/backend/src/main/java/com/edufocus/edufocus/quiz/controller/QuizController.java b/backend/src/main/java/com/edufocus/edufocus/quiz/controller/QuizController.java index b1e3fe5..4a874c9 100644 --- a/backend/src/main/java/com/edufocus/edufocus/quiz/controller/QuizController.java +++ b/backend/src/main/java/com/edufocus/edufocus/quiz/controller/QuizController.java @@ -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 quizUpdatedCheckMap = new HashMap<>();