Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
Expand Up @@ -59,7 +59,7 @@ public SuccessResponse<AdminSurveyDetailResponse> getQuestionsCompleted(
return SuccessResponse.ok(adminFacade.getSurveyDetail(surveyId));
}

@PatchMapping("/{surveyId}/owner")
@PatchMapping("/surveys/{surveyId}/owner")
@Operation(summary = "설문 소유자 변경 (어드민)", description = "어드민 권한으로 설문의 소유자를 변경합니다.")
public SuccessResponse<String> changeSurveyOwner(
@PathVariable Long surveyId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public record SurveyInformationDto(
String title,
String description,
String deadline,
String imageUrl,
Set<String> ages,
String gender,
String residence,
Expand All @@ -57,7 +56,6 @@ public static SurveyInformationDto from(SurveySingleViewInfo vo) {
vo.title(),
vo.description(),
vo.deadline() != null ? vo.deadline().toString() : null,
vo.imageUrl(),
vo.ages(),
vo.gender(),
vo.residence(),
Expand Down Expand Up @@ -155,8 +153,7 @@ public record SectionDto(
String title,
String description,
Integer order,
Integer nextSection,
String imageUrl
Integer nextSection
) {
public static SectionDto from(SurveySection vo) {
if (vo == null) return null;
Expand All @@ -165,8 +162,7 @@ public static SectionDto from(SurveySection vo) {
vo.title(),
vo.description(),
vo.order(),
vo.nextSection(),
vo.imageUrl()
vo.nextSection()
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ public record SurveySection (
String title,
String description,
Integer order,
Integer nextSection,
String imageUrl
Integer nextSection
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public record SurveySingleViewInfo(
String title,
String description,
LocalDate deadline,
String imageUrl,

Set<String> ages,
String gender,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public static SurveySingleViewInfo toSurveySingleViewInfo(SurveyDetailData surve
surveyDetailData.getTitle(),
surveyDetailData.getDescription(),
surveyDetailData.getDeadline() != null ? surveyDetailData.getDeadline().toLocalDate() : null,
surveyDetailData.getImageUrl(),
surveyDetailData.getAges().stream().map(Enum::name).collect(Collectors.toSet()),
surveyDetailData.getGender() != null ? surveyDetailData.getGender().name() : null,
surveyDetailData.getResidence() != null ? surveyDetailData.getResidence().name() : null,
Expand Down Expand Up @@ -136,8 +135,7 @@ public static SurveySection toSurveySection(SectionDto sectionDto) {
sectionDto.title(),
sectionDto.description(),
sectionDto.order(),
sectionDto.nextSection(),
sectionDto.imageUrl()
sectionDto.nextSection()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public abstract class Question extends BaseEntity {
@Builder.Default
protected Integer section = 1;

/* 임시 필드 */
@Column(name = "NEXT_SECTION")
protected Integer nextSection;
/* 섹션 엔티티 분리 후 제거 예정 */

@Column(name = "image_url", columnDefinition = "TEXT")
protected String imageUrl;

Expand All @@ -58,15 +53,13 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection,
String imageUrl
) {
this.title = title;
this.description = description;
this.isRequired = isRequired;
this.order = order;
this.section = (section != null) ? section : this.section;
this.nextSection = nextSection;
this.imageUrl = imageUrl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@ public class Section extends BaseEntity {
@Column(name = "NEXT_SECTION", nullable = false)
private Integer nextSection;

@Column(name = "image_url", columnDefinition = "TEXT")
private String imageUrl;

public void updateSection(String title, String description, Integer order, Integer nextSection, String imageUrl) {
public void updateSection(String title, String description, Integer order, Integer nextSection) {
this.title = title;
this.description = description;
this.sectionOrder = order;
this.nextSection = nextSection;
this.imageUrl = imageUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public static Choice of(
String description,
Boolean isRequired,
Integer section,
Integer nextSection,
Integer maxChoice,
Boolean hasNoneOption,
Boolean hasCustomInput,
Expand All @@ -59,7 +58,6 @@ public static Choice of(
.description(description)
.isRequired(isRequired)
.section(section)
.nextSection(nextSection)
.maxChoice(maxChoice)
.hasNoneOption(hasNoneOption)
.hasCustomInput(hasCustomInput)
Expand All @@ -75,14 +73,13 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection,
Integer maxChoice,
Boolean hasNoneOption,
Boolean hasCustomInput,
Boolean isSectionDecidable,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
super.updateQuestion(title, description, isRequired, order, section, imageUrl);
this.maxChoice = maxChoice;
this.hasNoneOption = (hasNoneOption != null) ? hasNoneOption : this.hasNoneOption;
this.hasCustomInput = (hasCustomInput != null) ? hasCustomInput : this.hasCustomInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public static DateAnswer of(
String description,
Boolean isRequired,
Integer section,
Integer nextSection,
LocalDateTime defaultDate,
QuestionType type,
String imageUrl
Expand All @@ -42,7 +41,6 @@ public static DateAnswer of(
.description(description)
.isRequired(isRequired)
.section(section)
.nextSection(nextSection)
.defaultDate(defaultDate)
.type(type.name())
.imageUrl(imageUrl)
Expand All @@ -55,11 +53,10 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection,
LocalDateTime defaultDate,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
super.updateQuestion(title, description, isRequired, order, section, imageUrl);
this.defaultDate = defaultDate;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package OneQ.OnSurvey.domain.question.entity.question;

import OneQ.OnSurvey.domain.question.entity.Question;
import OneQ.OnSurvey.domain.question.model.QuestionType;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

@Getter @SuperBuilder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
@DiscriminatorValue(value = QuestionType.Values.IMAGE)
public class Image extends Question {

public static Image of(
Long surveyId,
Integer order,
String title,
String description,
Boolean isRequired,
Integer section,
QuestionType type,
String imageUrl
) {
return Image.builder()
.surveyId(surveyId)
.order(order)
.title(title)
.description(description)
.isRequired(isRequired)
.type(type.name())
.section(section)
.imageUrl(imageUrl)
.build();
}

public void updateQuestion(
String title,
String description,
Boolean isRequired,
Integer order,
Integer section,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, imageUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public static LongAnswer of(
String description,
Boolean isRequired,
Integer section,
Integer nextSection,
QuestionType type,
String imageUrl
) {
Expand All @@ -34,7 +33,6 @@ public static LongAnswer of(
.isRequired(isRequired)
.type(type.name())
.section(section)
.nextSection(nextSection)
.imageUrl(imageUrl)
.build();
}
Expand All @@ -45,9 +43,8 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
super.updateQuestion(title, description, isRequired, order, section, imageUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public static NPS of(
String description,
Boolean isRequired,
Integer section,
Integer nextSection,
QuestionType type,
String imageUrl
) {
Expand All @@ -34,7 +33,6 @@ public static NPS of(
.isRequired(isRequired)
.type(type.name())
.section(section)
.nextSection(nextSection)
.imageUrl(imageUrl)
.build();
}
Expand All @@ -45,9 +43,8 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
super.updateQuestion(title, description, isRequired, order, section, imageUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public static NumberAnswer of(
String description,
Boolean isRequired,
Integer section,
Integer nextSection,
QuestionType type,
String imageUrl
) {
Expand All @@ -34,7 +33,6 @@ public static NumberAnswer of(
.isRequired(isRequired)
.type(type.name())
.section(section)
.nextSection(nextSection)
.imageUrl(imageUrl)
.build();
}
Expand All @@ -45,9 +43,8 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
super.updateQuestion(title, description, isRequired, order, section, imageUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public static Rating of(
String description,
Boolean isRequired,
Integer section,
Integer nextSection,
String maxValue,
String minValue,
Integer rate,
Expand All @@ -46,7 +45,6 @@ public static Rating of(
.description(description)
.isRequired(isRequired)
.section(section)
.nextSection(nextSection)
.maxValue(maxValue)
.minValue(minValue)
.rate(rate)
Expand All @@ -61,13 +59,12 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection,
String maxValue,
String minValue,
Integer rate,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
super.updateQuestion(title, description, isRequired, order, section, imageUrl);
this.maxValue = maxValue;
this.minValue = minValue;
this.rate = rate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public static ShortAnswer of(
String description,
Boolean isRequired,
Integer section,
Integer nextSection,
QuestionType type,
String imageUrl
) {
Expand All @@ -33,7 +32,6 @@ public static ShortAnswer of(
.description(description)
.isRequired(isRequired)
.section(section)
.nextSection(nextSection)
.type(type.name())
.imageUrl(imageUrl)
.build();
Expand All @@ -45,9 +43,8 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
super.updateQuestion(title, description, isRequired, order, section, imageUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum QuestionType {
LONG("장문형", Values.LONG),
NUMBER("숫자형", Values.NUMBER),
DATE("날짜형", Values.DATE),
IMAGE("이미지형", Values.IMAGE),
TEXT("주관식", Values.TEXT);
private final String description;
private final String value;
Expand All @@ -26,6 +27,7 @@ public static class Values {
public static final String NUMBER = "NUMBER";
public static final String DATE = "DATE";
public static final String TEXT = "TEXT";
public static final String IMAGE = "IMAGE";
}

public boolean isText() {
Expand Down
Loading
Loading