diff --git a/src/main/java/sopt/org/umbbaServer/domain/qna/model/QuestionSection.java b/src/main/java/sopt/org/umbbaServer/domain/qna/model/QuestionSection.java index 9e947f3a..219a8c6d 100644 --- a/src/main/java/sopt/org/umbbaServer/domain/qna/model/QuestionSection.java +++ b/src/main/java/sopt/org/umbbaServer/domain/qna/model/QuestionSection.java @@ -12,10 +12,10 @@ public enum QuestionSection { GOLDEN(3L, "청춘시절", 2), COUPLE(4L, "연애시절", 1), MARRIAGE(5L, "우리가 만나고", 1), - MARRIAGE2(6L, "우리가 만나고", 1); // 전연령 - 우리가 만나고 + MARRIAGE2(5L, "우리가 만나고", 1); // 전연령 - 우리가 만나고 ; - private final Long sectionId; + private final Long sectionId; //findBySectionId 하면 안됨 private final String value; private final int questionCount; } \ No newline at end of file diff --git a/src/main/java/sopt/org/umbbaServer/domain/qna/service/QnAService.java b/src/main/java/sopt/org/umbbaServer/domain/qna/service/QnAService.java index 96ec86fa..46d72494 100644 --- a/src/main/java/sopt/org/umbbaServer/domain/qna/service/QnAService.java +++ b/src/main/java/sopt/org/umbbaServer/domain/qna/service/QnAService.java @@ -88,6 +88,10 @@ public void answerTodayQuestion(Long userId, TodayAnswerRequestDto request) { public List getQnaList(Long userId, Long sectionId) { User myUser = getUserById(userId); + if (sectionId < 1L || sectionId > 5L) { + throw new CustomException(ErrorType.NOT_FOUND_SECTION); + } + Parentchild parentchild = getParentchildByUser(myUser); List qnaList = getQnAListByParentchild(parentchild); diff --git a/src/main/java/sopt/org/umbbaServer/global/exception/ErrorType.java b/src/main/java/sopt/org/umbbaServer/global/exception/ErrorType.java index 0cb95e58..73c386b8 100644 --- a/src/main/java/sopt/org/umbbaServer/global/exception/ErrorType.java +++ b/src/main/java/sopt/org/umbbaServer/global/exception/ErrorType.java @@ -58,6 +58,7 @@ public enum ErrorType { USER_HAVE_NO_QNALIST(HttpStatus.NOT_FOUND, "해당 유저가 가지고 있는 QnA 데이터가 없습니다."), PARENTCHILD_HAVE_NO_QNALIST(HttpStatus.NOT_FOUND, "부모자식 관계가 가지고 있는 QnA 데이터가 없습니다."), PARENTCHILD_HAVE_NO_OPPONENT(HttpStatus.NOT_FOUND, "부모자식 관계에 1명만 참여하고 있습니다."), + NOT_FOUND_SECTION(HttpStatus.NOT_FOUND, "해당 아이디와 일치하는 섹션이 없습니다."), /**