Skip to content

Commit

Permalink
refactor: Dto에 Enum 직접 사용하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
donghoony committed Dec 18, 2024
1 parent 32cc184 commit 914a2d8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package reviewme.template.service.dto.response;

import jakarta.annotation.Nullable;
import reviewme.template.domain.QuestionType;

public record QuestionResponse(
long questionId,
boolean required,
String content,
String questionType,
QuestionType questionType,
@Nullable OptionGroupResponse optionGroup,
boolean hasGuideline,
@Nullable String guideline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import jakarta.annotation.Nullable;
import java.util.List;
import reviewme.template.domain.VisibleType;

public record SectionResponse(
long sectionId,
String sectionName,
String visible,
VisibleType visible,
@Nullable Long onSelectedOptionId,
String header,
List<QuestionResponse> questions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private SectionResponse mapToSectionResponse(TemplateSection templateSection) {
return new SectionResponse(
section.getId(),
section.getSectionName(),
section.getVisibleType().name(),
section.getVisibleType(),
section.getOnSelectedOptionId(),
section.getHeader(),
questionResponses
Expand All @@ -90,7 +90,7 @@ private QuestionResponse mapToQuestionResponse(SectionQuestion sectionQuestion)
question.getId(),
question.isRequired(),
question.getContent(),
question.getQuestionType().name(),
question.getQuestionType(),
optionGroupResponse,
question.hasGuideline(),
question.getGuideline()
Expand Down
10 changes: 5 additions & 5 deletions backend/src/test/java/reviewme/api/TemplateFixture.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public static TemplateResponse templateResponse() {
1,
true,
"프로젝트 기간 동안, 아루의 강점이 드러났던 순간을 선택해주세요.",
QuestionType.CHECKBOX.name(),
QuestionType.CHECKBOX,
new OptionGroupResponse(1, 1, 2, firstSectionOptions),
false,
null
)
);
SectionResponse firstSection = new SectionResponse(
1, "카테고리 선택", VisibleType.ALWAYS.name(), null, "아루와 함께 한 기억을 떠올려볼게요.", firstSectionQuestions
1, "카테고리 선택", VisibleType.ALWAYS, null, "아루와 함께 한 기억을 떠올려볼게요.", firstSectionQuestions
);

// Section 2
Expand All @@ -50,7 +50,7 @@ public static TemplateResponse templateResponse() {
2,
true,
"커뮤니케이션, 협업 능력에서 어떤 부분이 인상 깊었는지 선택해주세요.",
QuestionType.CHECKBOX.name(),
QuestionType.CHECKBOX,
new OptionGroupResponse(2, 1, 3, secondSectionOptions),
false,
null
Expand All @@ -59,14 +59,14 @@ public static TemplateResponse templateResponse() {
3,
true,
"위에서 선택한 사항에 대해 조금 더 자세히 설명해주세요.",
QuestionType.TEXT.name(),
QuestionType.TEXT,
null,
true,
"상황을 자세하게 기록할수록 아루에게 도움이 돼요. 아루 덕분에 팀이 원활한 소통을 이뤘거나, 함께 일하면서 배울 점이 있었는지 떠올려 보세요."
)
);
SectionResponse secondSection = new SectionResponse(
2, "커뮤니케이션 능력", VisibleType.ALWAYS.name(), 1L, "아루의 커뮤니케이션, 협업 능력을 평가해주세요.", secondSectionQuestions
2, "커뮤니케이션 능력", VisibleType.ALWAYS, 1L, "아루의 커뮤니케이션, 협업 능력을 평가해주세요.", secondSectionQuestions
);

return new TemplateResponse(1, "아루", "리뷰미", List.of(firstSection, secondSection));
Expand Down

0 comments on commit 914a2d8

Please sign in to comment.