Package inha.git.question.api.controller
Class QuestionController
java.lang.Object
inha.git.question.api.controller.QuestionController
질문 관련 API를 처리하는 컨트롤러입니다.
질문의 조회, 생성, 수정, 삭제 및 좋아요 기능을 제공합니다.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateQuestion
(User user, CreateQuestionRequest createQuestionRequest) 질문 생성(기업제외) APIdeleteQuestion
(User user, Integer questionIdx) 질문 삭제 APIBaseResponse<org.springframework.data.domain.Page<SearchQuestionsResponse>>
getCondQuestions
(Integer page, Integer size, SearchQuestionCond searchQuestionCond) 질문 조건 조회 APIgetQuestion
(User user, Integer questionIdx) 질문 상세 조회 APIBaseResponse<org.springframework.data.domain.Page<SearchQuestionsResponse>>
getQuestions
(Integer page, Integer size) 전체 질문을 페이징하여 조회합니다.questionLike
(User user, @Valid LikeRequest likeRequest) 질문 좋아요 APIquestionLikeCancel
(User user, @Valid LikeRequest likeRequest) 질문 좋아요 취소 APIupdateQuestion
(User user, Integer questionIdx, UpdateQuestionRequest updateQuestionRequest) 질문 수정 API
-
Constructor Details
-
QuestionController
public QuestionController()
-
-
Method Details
-
getQuestions
@GetMapping public BaseResponse<org.springframework.data.domain.Page<SearchQuestionsResponse>> getQuestions(@RequestParam("page") Integer page, @RequestParam("size") Integer size) 전체 질문을 페이징하여 조회합니다.- Parameters:
page
- 조회할 페이지 번호 (1부터 시작)size
- 페이지당 항목 수- Returns:
- 페이징된 질문 목록
- Throws:
BaseException
- INVALID_PAGE: 페이지 번호가 유효하지 않은 경우 INVALID_SIZE: 페이지 크기가 유효하지 않은 경우
-
getCondQuestions
@GetMapping("/cond") public BaseResponse<org.springframework.data.domain.Page<SearchQuestionsResponse>> getCondQuestions(@RequestParam("page") Integer page, @RequestParam("size") Integer size, SearchQuestionCond searchQuestionCond) 질문 조건 조회 API- Parameters:
page
- Integersize
- IntegersearchQuestionCond
- SearchQuestionCond- Returns:
- 검색된 질문 정보를 포함하는 BaseResponse<Page
>
-
getQuestion
@GetMapping("/{questionIdx}") public BaseResponse<SearchQuestionResponse> getQuestion(@AuthenticationPrincipal User user, @PathVariable("questionIdx") Integer questionIdx) 질문 상세 조회 API질문 상세를 조회합니다.
- Parameters:
questionIdx
- Integer- Returns:
- 검색된 질문 정보를 포함하는 BaseResponse
-
createQuestion
@PostMapping public BaseResponse<QuestionResponse> createQuestion(@AuthenticationPrincipal User user, @Validated @RequestBody CreateQuestionRequest createQuestionRequest) 질문 생성(기업제외) API- Parameters:
user
- UsercreateQuestionRequest
- CreateQuestionRequest- Returns:
- 생성된 질문 정보를 포함하는 BaseResponse
-
updateQuestion
@PutMapping("/{questionIdx}") public BaseResponse<QuestionResponse> updateQuestion(@AuthenticationPrincipal User user, @PathVariable("questionIdx") Integer questionIdx, @Validated @RequestBody UpdateQuestionRequest updateQuestionRequest) 질문 수정 API- Parameters:
user
- UserquestionIdx
- IntegerupdateQuestionRequest
- UpdateQuestionRequest- Returns:
- 수정된 질문 정보를 포함하는 BaseResponse
-
deleteQuestion
@DeleteMapping("/{questionIdx}") public BaseResponse<QuestionResponse> deleteQuestion(@AuthenticationPrincipal User user, @PathVariable("questionIdx") Integer questionIdx) 질문 삭제 API- Parameters:
user
- UserquestionIdx
- Integer- Returns:
- 삭제된 질문 정보를 포함하는 BaseResponse
-
questionLike
@PostMapping("/like") public BaseResponse<String> questionLike(@AuthenticationPrincipal User user, @RequestBody @Valid @Valid LikeRequest likeRequest) 질문 좋아요 API특정 질문에 좋아요를 합니다.
- Parameters:
user
- 로그인한 사용자 정보likeRequest
- 좋아요할 질문 정보- Returns:
- 좋아요 성공 메시지를 포함하는 BaseResponse
-
questionLikeCancel
@DeleteMapping("/like") public BaseResponse<String> questionLikeCancel(@AuthenticationPrincipal User user, @RequestBody @Valid @Valid LikeRequest likeRequest) 질문 좋아요 취소 API- Parameters:
user
- 로그인한 사용자 정보likeRequest
- 좋아요할 질문 정보- Returns:
- 좋아요 취소 성공 메시지를 포함하는 BaseResponse
-