-
Notifications
You must be signed in to change notification settings - Fork 5
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] 체크리스트 카테고리별 질문 비교 기능을 구현한다. #963
base: dev-be
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
간단한 리뷰만 남겼습니다.
추가로, 개수(숫자)나 %값은 서버 단에서 주지 않기로 이미 합의되는지 궁금하네요!
Assertions.assertThat(good.get(0).getQuestionId()).isEqualTo(checklist1Question2Good.getQuestionId()); | ||
Assertions.assertThat(bad).hasSize(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static import를 쓰면 가독성이 올라갈 것 같네요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다!
private List<QuestionResponse> categorizeQuestionsByAnswer(ChecklistQuestions checklistQuestions, Answer answer) { | ||
return checklistQuestions.filterByAnswer(answer) | ||
.stream() | ||
.map(checklistQuestion -> new QuestionResponse(checklistQuestion.getQuestion(), questionService.readHighlights(checklistQuestion.getQuestionId()))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Highlight가 비교 페이지에서 꼭 필요하지 않다면 가져오지 않는 방향으로 가는 게 더 좋아보이긴 합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다! 리뷰 남겼는데 한번 확인 부탁드려요!
궁금한게 있는데, 저희가 카테고리의 질문과 답변을 답변 기준으로 나눠서 보내면, 이 데이터를 그대로 보여주기 위한 api인가요 아니면 프론트에서 추가작업을 하는 건가요?
public boolean hasAnswer(Answer answer) { | ||
return this.answer.equals(answer); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasAnswer라는 메서드 명이 그냥 Answer를 가지고 있는지 여부를 반환하는 의미로 해석될 수도 있을 것 같아요!
matchesAnswer
나 다른 함수명을 고려해보는 것은 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matchAnswer로 변경했습니다!
|
||
import java.util.List; | ||
|
||
public record ComparisonCategoryChecklistQuestionResponse(List<QuestionResponse> good, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dto이름이 한눈에 와닿지 않는 것 같은데, 가지고 있는 데이터를 이름에 담는 방향은 어떻게 생각하시나요?
AnswerCategorizedQuestionsResponse
이런 느낌으로 생각해봤는데 정확하게 어떤게 좋을지는 잘 모르겠네요🤔
Assertions.assertThat(good).hasSize(1); | ||
Assertions.assertThat(good.get(0).getQuestionId()).isEqualTo(checklist1Question2Good.getQuestionId()); | ||
Assertions.assertThat(bad).hasSize(1); | ||
Assertions.assertThat(bad.get(0).getQuestionId()).isEqualTo(checklist1Question1Bad.getQuestionId()); | ||
Assertions.assertThat(none).isEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertAll로 묶는 건 어떤가요!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
딱히 큰 피드백은 없네요!
수고하셨습니다~
@@ -34,6 +36,13 @@ public ResponseEntity<CategoryCustomChecklistQuestionsResponse> readAllCustomChe | |||
return ResponseEntity.ok(questionManageService.readAllCustomChecklistQuestions(user)); | |||
} | |||
|
|||
@GetMapping("/v1/comparison/checklists/{checklistId}/categories/{categoryId}/questions") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryString으로 설계하지 않고 계층적으로 설계하신 이유가 궁금해요!
계층적 설계가 들어가서 checklists가 먼저 나오니 QuestionController에 위치한 게 어색하다는 생각도 들어서요~
❗ Issue
✨ 구현한 기능
해당 커밋으로 확인해주세요
📢 논의하고 싶은 내용
🎸 기타