Package inha.git.question.api.service
Class QuestionServiceImpl
java.lang.Object
inha.git.question.api.service.QuestionServiceImpl
- All Implemented Interfaces:
QuestionService
@Service
@Transactional(readOnly=true)
public class QuestionServiceImpl
extends Object
implements QuestionService
질문 관련 비즈니스 로직을 처리하는 서비스 구현체입니다.
질문의 조회, 생성, 수정, 삭제 및 관련 통계 처리를 담당합니다.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateQuestion
(User user, CreateQuestionRequest createQuestionRequest) 질문 생성createQuestionLike
(User user, LikeRequest likeRequest) 질문 좋아요 생성deleteQuestion
(User user, Integer questionIdx) 질문 삭제org.springframework.data.domain.Page<SearchQuestionsResponse>
getCondQuestions
(SearchQuestionCond searchQuestionCond, Integer page, Integer size) 질문 조건 조회getQuestion
(User user, Integer questionIdx) 질문 상세 조회org.springframework.data.domain.Page<SearchQuestionsResponse>
getQuestions
(Integer page, Integer size) 전체 질문을 페이징하여 조회합니다.questionLikeCancel
(User user, LikeRequest likeRequest) 질문 좋아요 취소updateQuestion
(User user, Integer questionIdx, UpdateQuestionRequest updateQuestionRequest) 질문 수정
-
Constructor Details
-
QuestionServiceImpl
public QuestionServiceImpl()
-
-
Method Details
-
getQuestions
public org.springframework.data.domain.Page<SearchQuestionsResponse> getQuestions(Integer page, Integer size) 전체 질문을 페이징하여 조회합니다.- Specified by:
getQuestions
in interfaceQuestionService
- Parameters:
page
- 조회할 페이지 번호 (0부터 시작)size
- 페이지당 항목 수- Returns:
- 페이징된 질문 목록
-
getCondQuestions
public org.springframework.data.domain.Page<SearchQuestionsResponse> getCondQuestions(SearchQuestionCond searchQuestionCond, Integer page, Integer size) 질문 조건 조회- Specified by:
getCondQuestions
in interfaceQuestionService
- Parameters:
searchQuestionCond
- SearchQuestionCondpage
- Integersize
- Integer- Returns:
- Page
-
getQuestion
질문 상세 조회- Specified by:
getQuestion
in interfaceQuestionService
- Parameters:
questionIdx
- Integer- Returns:
- SearchQuestionResponse
- Throws:
BaseException
- QUESTION_NOT_FOUND: 질문을 찾을 수 없는 경우
-
createQuestion
@Transactional public QuestionResponse createQuestion(User user, CreateQuestionRequest createQuestionRequest) 질문 생성- Specified by:
createQuestion
in interfaceQuestionService
- Parameters:
user
- UsercreateQuestionRequest
- CreateQuestionRequest- Returns:
- QuestionResponse
- Throws:
BaseException
- SEMESTER_NOT_FOUND: 학기를 찾을 수 없는 경우 CATEGORY_NOT_FOUND: 카테고리를 찾을 수 없는 경우 FIELD_NOT_FOUND: 필드를 찾을 수 없는 경우 QUESTION_NOT_AUTHORIZED: 질문 수정 권한이 없는 경우
-
updateQuestion
@Transactional public QuestionResponse updateQuestion(User user, Integer questionIdx, UpdateQuestionRequest updateQuestionRequest) 질문 수정- Specified by:
updateQuestion
in interfaceQuestionService
- Parameters:
user
- UserquestionIdx
- IntegerupdateQuestionRequest
- UpdateQuestionRequest- Returns:
- QuestionResponse
- Throws:
BaseException
- SEMESTER_NOT_FOUND: 학기를 찾을 수 없는 경우 FIELD_NOT_FOUND: 필드를 찾을 수 없는 경우 QUESTION_NOT_AUTHORIZED: 질문 수정 권한이 없는 경우 FIELD_NOT_FOUND: 필드를 찾을 수 없는 경우 QUESTION_NOT_FOUND: 질문을 찾을 수 없는 경우
-
deleteQuestion
질문 삭제- Specified by:
deleteQuestion
in interfaceQuestionService
- Parameters:
user
- UserquestionIdx
- Integer- Returns:
- QuestionResponse
- Throws:
BaseException
- QUESTION_DELETE_NOT_AUTHORIZED: 질문 삭제 권한이 없는 경우 QUESTION_NOT_FOUND: 질문을 찾을 수 없는 경우
-
createQuestionLike
질문 좋아요 생성- Specified by:
createQuestionLike
in interfaceQuestionService
- Parameters:
user
- UserlikeRequest
- LikeRequest- Returns:
- String
- Throws:
BaseException
- QUESTION_NOT_FOUND: 질문을 찾을 수 없는 경우 MY_QUESTION_LIKE: 내 질문은 좋아요할 수 없는 경우 QUESTION_ALREADY_LIKE: 이미 좋아요한 질문인 경우
-
questionLikeCancel
질문 좋아요 취소- Specified by:
questionLikeCancel
in interfaceQuestionService
- Parameters:
user
- UserlikeRequest
- LikeRequest- Returns:
- String
- Throws:
BaseException
- QUESTION_NOT_FOUND: 질문을 찾을 수 없는 경우 MY_QUESTION_LIKE: 내 질문은 좋아요할 수 없는 경우 QUESTION_NOT_LIKE: 좋아요하지 않은 질문인 경우
-