Skip to content

Commit

Permalink
feat: 질문 삭제 API 개발(#7)
Browse files Browse the repository at this point in the history
* Delete Controller 개발
* deleteQuestion Service 개발
  • Loading branch information
isieun0908 committed Apr 24, 2023
1 parent 47b6dbb commit 94df6ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 94df6ca

Please sign in to comment.