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: DTO에서 Enum 사용하도록 수정 #1012

Merged
merged 3 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package reviewme.template.domain;

public enum OptionType {

CATEGORY,
KEYWORD,
;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package reviewme.template.domain;

public enum QuestionType {

CHECKBOX,
TEXT,
;

}
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
Loading