Skip to content
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
Expand Up @@ -43,6 +43,7 @@ public record SurveyInformationDto(
String title,
String description,
String deadline,
String imageUrl,
Set<String> ages,
String gender,
String residence,
Expand All @@ -56,6 +57,7 @@ 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 All @@ -73,6 +75,7 @@ public record QuestionDto(
Boolean isRequired,
Integer questionOrder,
Integer section,
String imageUrl,
ChoicePropDto choiceProperty,
RatingPropDto ratingProperty,
DatePropDto dateProperty
Expand All @@ -87,6 +90,7 @@ public static QuestionDto from(SurveyQuestion vo) {
vo.isRequired(),
vo.questionOrder(),
vo.section(),
vo.imageUrl(),
ChoicePropDto.from(vo.choiceProperty()),
RatingPropDto.from(vo.ratingProperty()),
DatePropDto.from(vo.dateProperty())
Expand All @@ -108,10 +112,10 @@ public static ChoicePropDto from(SurveyQuestion.ChoiceProp vo) {
return new ChoicePropDto(vo.maxChoice(), vo.hasCustomInput(), vo.hasNoneOption(), vo.isSectionDecidable(), optionDtos);
}

public record OptionDto(String content, Integer nextSection) {
public record OptionDto(String content, Integer nextSection, String imageUrl) {
public static OptionDto from(SurveyQuestion.ChoiceProp.Option vo) {
if (vo == null) return null;
return new OptionDto(vo.content(), vo.nextSection());
return new OptionDto(vo.content(), vo.nextSection(), vo.imageUrl());
}
}
}
Expand Down Expand Up @@ -151,7 +155,8 @@ public record SectionDto(
String title,
String description,
Integer order,
Integer nextSection
Integer nextSection,
String imageUrl
) {
public static SectionDto from(SurveySection vo) {
if (vo == null) return null;
Expand All @@ -160,7 +165,8 @@ public static SectionDto from(SurveySection vo) {
vo.title(),
vo.description(),
vo.order(),
vo.nextSection()
vo.nextSection(),
vo.imageUrl()
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ public class AdminAuthService {
public String authenticate(String username, String rawPassword) {

Admin admin = adminRepository.findByUsername(username);
if (admin == null
// || !admin.matchPassword(passwordEncoder, rawPassword)
|| !admin.getPassword().equals(rawPassword)
) {
if (admin == null || !admin.matchPassword(passwordEncoder, rawPassword)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public record SurveyQuestion(
Boolean isRequired,
Integer questionOrder,
Integer section,
String imageUrl,

ChoiceProp choiceProperty,
RatingProp ratingProperty,
Expand All @@ -29,7 +30,8 @@ public record ChoiceProp (
) {
public record Option (
String content,
Integer nextSection
Integer nextSection,
String imageUrl
) {}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public record SurveySection (
String title,
String description,
Integer order,
Integer nextSection
Integer nextSection,
String imageUrl
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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,6 +54,7 @@ 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 All @@ -72,7 +73,8 @@ public static SurveyQuestion toSurveyQuestion(DefaultQuestionDto questionDto) {
.description(questionDto.getDescription())
.isRequired(questionDto.getIsRequired())
.questionOrder(questionDto.getQuestionOrder())
.section(questionDto.getSection());
.section(questionDto.getSection())
.imageUrl(questionDto.getImageUrl());

return switch (questionDto.getQuestionType()) {
case "CHOICE" -> {
Expand All @@ -86,7 +88,8 @@ public static SurveyQuestion toSurveyQuestion(DefaultQuestionDto questionDto) {
choice.getOptions().stream()
.map(optionDto -> new SurveyQuestion.ChoiceProp.Option(
optionDto.getContent(),
optionDto.getNextSection()
optionDto.getNextSection(),
optionDto.getImageUrl()
))
.collect(Collectors.toSet()
)
Expand Down Expand Up @@ -133,7 +136,8 @@ public static SurveySection toSurveySection(SectionDto sectionDto) {
sectionDto.title(),
sectionDto.description(),
sectionDto.order(),
sectionDto.nextSection()
sectionDto.nextSection(),
sectionDto.imageUrl()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,31 @@ public class ChoiceOption {
@Column(name = "next_section")
private Integer nextSection;

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

public static ChoiceOption of(
Long questionId,
String content,
Integer nextSection
Integer nextSection,
String imageUrl
) {
return ChoiceOption.builder()
.questionId(questionId)
.content(content)
.nextSection(nextSection)
.imageUrl(imageUrl)
.build();
}

public void updateOption(
String content,
Integer nextSection
Integer nextSection,
String imageUrl
) {
this.content = content;
this.nextSection = nextSection;
this.imageUrl = imageUrl;
}

public void updateChoiceOption(String content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,25 @@ public abstract class Question extends BaseEntity {
protected Integer nextSection;
/* 섹션 엔티티 분리 후 제거 예정 */

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

public void updateQuestion(
String title,
String description,
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection
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;
}

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

public void updateSection(String title, String description, Integer order, Integer nextSection) {
@Column(name = "image_url", columnDefinition = "TEXT")
private String imageUrl;

public void updateSection(String title, String description, Integer order, Integer nextSection, String imageUrl) {
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 @@ -49,7 +49,8 @@ public static Choice of(
Boolean hasNoneOption,
Boolean hasCustomInput,
Boolean isSectionDecidable,
QuestionType type
QuestionType type,
String imageUrl
) {
return Choice.builder()
.surveyId(surveyId)
Expand All @@ -64,6 +65,7 @@ public static Choice of(
.hasCustomInput(hasCustomInput)
.isSectionDecidable(isSectionDecidable)
.type(type.name())
.imageUrl(imageUrl)
.build();
}

Expand All @@ -77,9 +79,10 @@ public void updateQuestion(
Integer maxChoice,
Boolean hasNoneOption,
Boolean hasCustomInput,
Boolean isSectionDecidable
Boolean isSectionDecidable,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection);
super.updateQuestion(title, description, isRequired, order, section, nextSection, 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 @@ -32,7 +32,8 @@ public static DateAnswer of(
Integer section,
Integer nextSection,
LocalDateTime defaultDate,
QuestionType type
QuestionType type,
String imageUrl
) {
return DateAnswer.builder()
.surveyId(surveyId)
Expand All @@ -44,6 +45,7 @@ public static DateAnswer of(
.nextSection(nextSection)
.defaultDate(defaultDate)
.type(type.name())
.imageUrl(imageUrl)
.build();
}

Expand All @@ -54,9 +56,10 @@ public void updateQuestion(
Integer order,
Integer section,
Integer nextSection,
LocalDateTime defaultDate
LocalDateTime defaultDate,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection);
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
this.defaultDate = defaultDate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public static LongAnswer of(
Boolean isRequired,
Integer section,
Integer nextSection,
QuestionType type
QuestionType type,
String imageUrl
) {
return LongAnswer.builder()
.surveyId(surveyId)
Expand All @@ -34,6 +35,7 @@ public static LongAnswer of(
.type(type.name())
.section(section)
.nextSection(nextSection)
.imageUrl(imageUrl)
.build();
}

Expand All @@ -43,8 +45,9 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection
Integer nextSection,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection);
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public static NPS of(
Boolean isRequired,
Integer section,
Integer nextSection,
QuestionType type
QuestionType type,
String imageUrl
) {
return NPS.builder()
.surveyId(surveyId)
Expand All @@ -34,6 +35,7 @@ public static NPS of(
.type(type.name())
.section(section)
.nextSection(nextSection)
.imageUrl(imageUrl)
.build();
}

Expand All @@ -43,8 +45,9 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection
Integer nextSection,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection);
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public static NumberAnswer of(
Boolean isRequired,
Integer section,
Integer nextSection,
QuestionType type
QuestionType type,
String imageUrl
) {
return NumberAnswer.builder()
.surveyId(surveyId)
Expand All @@ -34,6 +35,7 @@ public static NumberAnswer of(
.type(type.name())
.section(section)
.nextSection(nextSection)
.imageUrl(imageUrl)
.build();
}

Expand All @@ -43,8 +45,9 @@ public void updateQuestion(
Boolean isRequired,
Integer order,
Integer section,
Integer nextSection
Integer nextSection,
String imageUrl
) {
super.updateQuestion(title, description, isRequired, order, section, nextSection);
super.updateQuestion(title, description, isRequired, order, section, nextSection, imageUrl);
}
}
Loading
Loading