Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] refactor: 필수 질문이 아닌 경우 최소 글자수 제한 제거 #589

Merged
merged 4 commits into from
Sep 15, 2024

Conversation

Kimprodp
Copy link
Contributor


🚀 어떤 기능을 구현했나요 ?

  • 서술형 필수 질문이 아닌 경우 최소 글자수 제한을 받지 않도록 변경했습니다.

🔥 어떻게 해결했나요 ?

  • textAnswerValidator에서 textAnswer 글자수 검증 시, 질문의 필수여부에 따라 분기처리 했습니다.

📝 어떤 부분에 집중해서 리뷰해야 할까요?

📚 참고 자료, 할 말

Copy link

github-actions bot commented Sep 10, 2024

Test Results

93 tests  +2   93 ✅ +2   3s ⏱️ ±0s
31 suites ±0    0 💤 ±0 
31 files   ±0    0 ❌ ±0 

Results for commit 63da839. ± Comparison against base commit b67a0c8.

♻️ This comment has been updated with latest results.

@Kimprodp Kimprodp changed the title [Be] refactor: 필수 질문이 아닌 경우 최소 글자수 제한 제거 [BE] refactor: 필수 질문이 아닌 경우 최소 글자수 제한 제거 Sep 10, 2024
Copy link
Contributor

@donghoony donghoony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정 사항 한 가지 남겨두고 어프룹 드립니다 👍🏻

}

if (!question.isRequired() && answerLength > MAX_LENGTH) {
throw new InvalidTextAnswerLengthException(question.getId(), answerLength, ZERO_LENGTH, MAX_LENGTH);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로그에서만 사용되는 것이라면 Exception(QuestionId, length, maxLength) 생성자를 만들어 min이 0일 때로 사용하면 어떨까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조하요 반영했습니다~

Copy link
Contributor

@skylar1220 skylar1220 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳굳~ 쿨프로브~~
725D9179-7256-42B0-AFF1-1B5CDE53863A_4_5005_c

Copy link
Contributor

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어푸푸푸릅 드립니다~🥳 수고하셨습니다!!

Comment on lines +31 to +35
if (question.isRequired() && (answerLength < MIN_LENGTH || answerLength > MAX_LENGTH)) {
throw new InvalidTextAnswerLengthException(question.getId(), answerLength, MIN_LENGTH, MAX_LENGTH);
}

if (!question.isRequired() && answerLength > MAX_LENGTH) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 좋네요 이 함수 가독성 짱짱~

Comment on lines +52 to +58
@Test
void 선택_질문의_답변_길이가_유효하지_않으면_예외가_발생한다() {
// given
String content = "답".repeat(10001);
Question savedQuestion = questionRepository.save(서술형_옵션_질문());
TextAnswer textAnswer = new TextAnswer(savedQuestion.getId(), content);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 코드도 잘 작성된 것 같아요😇

@Kimprodp Kimprodp merged commit 5acb425 into develop Sep 15, 2024
1 check passed
@donghoony donghoony deleted the be/refactor/453-optional-text-question-min-length branch September 26, 2024 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BE] 필수가 아닌 선택적 질문 중 서술형 타입은 최소 글자수를 설정하지 않는다.
4 participants