diff --git a/classmate/src/main/java/devteamOne/classmate/question/controller/QuestionController.java b/classmate/src/main/java/devteamOne/classmate/question/controller/QuestionController.java index 3ab12cf..3a97b47 100644 --- a/classmate/src/main/java/devteamOne/classmate/question/controller/QuestionController.java +++ b/classmate/src/main/java/devteamOne/classmate/question/controller/QuestionController.java @@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity.BodyBuilder; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -32,4 +33,12 @@ public Boolean modify(@PathVariable Long question_id, @RequestBody QuestionReque return true; } + + @DeleteMapping("/question/{question_id}") + public Boolean delete(@PathVariable Long question_id) { + + questionService.deleteQuestion(question_id); + + return true; + } } diff --git a/classmate/src/main/java/devteamOne/classmate/question/service/QuestionService.java b/classmate/src/main/java/devteamOne/classmate/question/service/QuestionService.java index 6e655a9..4e29b74 100644 --- a/classmate/src/main/java/devteamOne/classmate/question/service/QuestionService.java +++ b/classmate/src/main/java/devteamOne/classmate/question/service/QuestionService.java @@ -41,4 +41,12 @@ public void modifyContent(Long question_id, QuestionRequest questionRequest) { question.modifyContent(questionRequest.getContent()); questionRepository.save(question); } + + public void deleteQuestion(Long question_id) { + + // user 조회 및 권한 확인 + + // question 삭제 + questionRepository.deleteById(question_id); + } }