diff --git a/src/main/java/OneQ/OnSurvey/domain/admin/api/AdminController.java b/src/main/java/OneQ/OnSurvey/domain/admin/api/AdminController.java index 2e46e99a..93e7e717 100644 --- a/src/main/java/OneQ/OnSurvey/domain/admin/api/AdminController.java +++ b/src/main/java/OneQ/OnSurvey/domain/admin/api/AdminController.java @@ -59,7 +59,7 @@ public SuccessResponse getQuestionsCompleted( return SuccessResponse.ok(adminFacade.getSurveyDetail(surveyId)); } - @PatchMapping("/{surveyId}/owner") + @PatchMapping("/surveys/{surveyId}/owner") @Operation(summary = "설문 소유자 변경 (어드민)", description = "어드민 권한으로 설문의 소유자를 변경합니다.") public SuccessResponse changeSurveyOwner( @PathVariable Long surveyId, diff --git a/src/main/java/OneQ/OnSurvey/domain/admin/api/dto/response/AdminSurveyDetailResponse.java b/src/main/java/OneQ/OnSurvey/domain/admin/api/dto/response/AdminSurveyDetailResponse.java index 3d6b89de..428a54a1 100644 --- a/src/main/java/OneQ/OnSurvey/domain/admin/api/dto/response/AdminSurveyDetailResponse.java +++ b/src/main/java/OneQ/OnSurvey/domain/admin/api/dto/response/AdminSurveyDetailResponse.java @@ -43,7 +43,6 @@ public record SurveyInformationDto( String title, String description, String deadline, - String imageUrl, Set ages, String gender, String residence, @@ -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(), @@ -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; @@ -165,8 +162,7 @@ public static SectionDto from(SurveySection vo) { vo.title(), vo.description(), vo.order(), - vo.nextSection(), - vo.imageUrl() + vo.nextSection() ); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveySection.java b/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveySection.java index a4e6add7..1c9ffda2 100644 --- a/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveySection.java +++ b/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveySection.java @@ -5,7 +5,6 @@ public record SurveySection ( String title, String description, Integer order, - Integer nextSection, - String imageUrl + Integer nextSection ) { } diff --git a/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveySingleViewInfo.java b/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveySingleViewInfo.java index f07dcc28..2ddff995 100644 --- a/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveySingleViewInfo.java +++ b/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveySingleViewInfo.java @@ -8,7 +8,6 @@ public record SurveySingleViewInfo( String title, String description, LocalDate deadline, - String imageUrl, Set ages, String gender, diff --git a/src/main/java/OneQ/OnSurvey/domain/admin/infra/mapper/AdminSurveyMapper.java b/src/main/java/OneQ/OnSurvey/domain/admin/infra/mapper/AdminSurveyMapper.java index 5f6048a4..c7b0c9a6 100644 --- a/src/main/java/OneQ/OnSurvey/domain/admin/infra/mapper/AdminSurveyMapper.java +++ b/src/main/java/OneQ/OnSurvey/domain/admin/infra/mapper/AdminSurveyMapper.java @@ -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, @@ -136,8 +135,7 @@ public static SurveySection toSurveySection(SectionDto sectionDto) { sectionDto.title(), sectionDto.description(), sectionDto.order(), - sectionDto.nextSection(), - sectionDto.imageUrl() + sectionDto.nextSection() ); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/Question.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/Question.java index b7b43d0b..7cc148a3 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/Question.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/Question.java @@ -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; @@ -58,7 +53,6 @@ public void updateQuestion( Boolean isRequired, Integer order, Integer section, - Integer nextSection, String imageUrl ) { this.title = title; @@ -66,7 +60,6 @@ public void updateQuestion( this.isRequired = isRequired; this.order = order; this.section = (section != null) ? section : this.section; - this.nextSection = nextSection; this.imageUrl = imageUrl; } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/Section.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/Section.java index c13636d5..6cdc6044 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/Section.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/Section.java @@ -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; } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Choice.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Choice.java index 4f712ffc..365aec30 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Choice.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Choice.java @@ -44,7 +44,6 @@ public static Choice of( String description, Boolean isRequired, Integer section, - Integer nextSection, Integer maxChoice, Boolean hasNoneOption, Boolean hasCustomInput, @@ -59,7 +58,6 @@ public static Choice of( .description(description) .isRequired(isRequired) .section(section) - .nextSection(nextSection) .maxChoice(maxChoice) .hasNoneOption(hasNoneOption) .hasCustomInput(hasCustomInput) @@ -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; diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/DateAnswer.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/DateAnswer.java index 75e08fc5..4c8e2efc 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/DateAnswer.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/DateAnswer.java @@ -30,7 +30,6 @@ public static DateAnswer of( String description, Boolean isRequired, Integer section, - Integer nextSection, LocalDateTime defaultDate, QuestionType type, String imageUrl @@ -42,7 +41,6 @@ public static DateAnswer of( .description(description) .isRequired(isRequired) .section(section) - .nextSection(nextSection) .defaultDate(defaultDate) .type(type.name()) .imageUrl(imageUrl) @@ -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; } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Image.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Image.java new file mode 100644 index 00000000..a4b7a1d5 --- /dev/null +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Image.java @@ -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); + } +} diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/LongAnswer.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/LongAnswer.java index d3d6a995..8becc3a6 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/LongAnswer.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/LongAnswer.java @@ -22,7 +22,6 @@ public static LongAnswer of( String description, Boolean isRequired, Integer section, - Integer nextSection, QuestionType type, String imageUrl ) { @@ -34,7 +33,6 @@ public static LongAnswer of( .isRequired(isRequired) .type(type.name()) .section(section) - .nextSection(nextSection) .imageUrl(imageUrl) .build(); } @@ -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); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/NPS.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/NPS.java index f399aff8..6bd8a7f1 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/NPS.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/NPS.java @@ -22,7 +22,6 @@ public static NPS of( String description, Boolean isRequired, Integer section, - Integer nextSection, QuestionType type, String imageUrl ) { @@ -34,7 +33,6 @@ public static NPS of( .isRequired(isRequired) .type(type.name()) .section(section) - .nextSection(nextSection) .imageUrl(imageUrl) .build(); } @@ -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); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/NumberAnswer.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/NumberAnswer.java index aad2bd4f..383bc169 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/NumberAnswer.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/NumberAnswer.java @@ -22,7 +22,6 @@ public static NumberAnswer of( String description, Boolean isRequired, Integer section, - Integer nextSection, QuestionType type, String imageUrl ) { @@ -34,7 +33,6 @@ public static NumberAnswer of( .isRequired(isRequired) .type(type.name()) .section(section) - .nextSection(nextSection) .imageUrl(imageUrl) .build(); } @@ -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); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Rating.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Rating.java index 0077b426..d887f2c2 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Rating.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/Rating.java @@ -32,7 +32,6 @@ public static Rating of( String description, Boolean isRequired, Integer section, - Integer nextSection, String maxValue, String minValue, Integer rate, @@ -46,7 +45,6 @@ public static Rating of( .description(description) .isRequired(isRequired) .section(section) - .nextSection(nextSection) .maxValue(maxValue) .minValue(minValue) .rate(rate) @@ -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; diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/ShortAnswer.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/ShortAnswer.java index cb36f754..d8e920b9 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/question/ShortAnswer.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/question/ShortAnswer.java @@ -22,7 +22,6 @@ public static ShortAnswer of( String description, Boolean isRequired, Integer section, - Integer nextSection, QuestionType type, String imageUrl ) { @@ -33,7 +32,6 @@ public static ShortAnswer of( .description(description) .isRequired(isRequired) .section(section) - .nextSection(nextSection) .type(type.name()) .imageUrl(imageUrl) .build(); @@ -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); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/model/QuestionType.java b/src/main/java/OneQ/OnSurvey/domain/question/model/QuestionType.java index 37ab360b..c144f852 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/model/QuestionType.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/model/QuestionType.java @@ -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; @@ -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() { diff --git a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/QuestionUpsertDto.java b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/QuestionUpsertDto.java index 3abfcd2b..c8f3c701 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/QuestionUpsertDto.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/QuestionUpsertDto.java @@ -27,10 +27,6 @@ public static class UpsertInfo { QuestionType questionType; Integer questionOrder; Integer section; - - // 임시 필드 - Integer nextSection; - String imageUrl; // Choice 필드 diff --git a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/SectionDto.java b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/SectionDto.java index eabbaeaa..2d84c418 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/SectionDto.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/SectionDto.java @@ -8,8 +8,7 @@ public record SectionDto ( String title, String description, Integer order, - Integer nextSection, - String imageUrl + Integer nextSection ) { public static SectionDto fromEntity(Section section) { @@ -18,8 +17,7 @@ public static SectionDto fromEntity(Section section) { section.getTitle(), section.getDescription(), section.getSectionOrder(), - section.getNextSection(), - section.getImageUrl() + section.getNextSection() ); } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/ChoiceDto.java b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/ChoiceDto.java index 60a20a98..9f05a1cb 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/ChoiceDto.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/ChoiceDto.java @@ -34,7 +34,6 @@ public static ChoiceDto fromEntity(Choice choice) { .isRequired(choice.getIsRequired()) .questionOrder(choice.getOrder()) .section(choice.getSection() != null ? choice.getSection() : 1) - .nextSection(choice.getNextSection()) .imageUrl(choice.getImageUrl()) .build(); } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/DateDto.java b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/DateDto.java index 41313e89..ea5ccb05 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/DateDto.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/DateDto.java @@ -25,7 +25,6 @@ public static DateDto fromEntity(DateAnswer date) { .isRequired(date.getIsRequired()) .questionOrder(date.getOrder()) .section(date.getSection() != null ? date.getSection() : 1) - .nextSection(date.getNextSection()) .imageUrl(date.getImageUrl()) .build(); } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/DefaultQuestionDto.java b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/DefaultQuestionDto.java index af78a370..8fbe3ca2 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/DefaultQuestionDto.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/DefaultQuestionDto.java @@ -42,10 +42,6 @@ public class DefaultQuestionDto { private Boolean isRequired; private Integer questionOrder; private Integer section; - - // 임시 필드 - private Integer nextSection; - private String imageUrl; public static DefaultQuestionDto fromEntity(Question question) { @@ -58,7 +54,6 @@ public static DefaultQuestionDto fromEntity(Question question) { .isRequired(question.getIsRequired()) .questionOrder(question.getOrder()) .section(question.getSection() != null ? question.getSection() : 1) - .nextSection(question.getNextSection()) .imageUrl(question.getImageUrl()) .build(); } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/RatingDto.java b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/RatingDto.java index 720c7d2f..2d7e4cc0 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/RatingDto.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/type/RatingDto.java @@ -27,7 +27,6 @@ public static RatingDto fromEntity(Rating rating) { .isRequired(rating.getIsRequired()) .questionOrder(rating.getOrder()) .section(rating.getSection() != null ? rating.getSection() : 1) - .nextSection(rating.getNextSection()) .imageUrl(rating.getImageUrl()) .build(); } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/repository/section/SectionRepositoryImpl.java b/src/main/java/OneQ/OnSurvey/domain/question/repository/section/SectionRepositoryImpl.java index c5191ab5..ff97b679 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/repository/section/SectionRepositoryImpl.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/repository/section/SectionRepositoryImpl.java @@ -36,8 +36,7 @@ public SectionDto findSectionDtoBySurveyIdAndOrder(long surveyId, int order) { section.title, section.description, section.sectionOrder, - section.nextSection, - section.imageUrl + section.nextSection )) .from(section) .where( @@ -54,8 +53,7 @@ public List findAllSectionDtoBySurveyId(long surveyId) { section.title, section.description, section.sectionOrder, - section.nextSection, - section.imageUrl + section.nextSection )) .from(section) .where( diff --git a/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionCommandService.java b/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionCommandService.java index d0843fe0..ded5dd8b 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionCommandService.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionCommandService.java @@ -132,7 +132,6 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getMaxChoice(), upsertInfo.getHasNoneOption(), upsertInfo.getHasCustomInput(), @@ -146,7 +145,6 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getMaxValue(), upsertInfo.getMinValue(), upsertInfo.getRate(), @@ -159,7 +157,6 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getImageUrl() ); } else if (question instanceof DateAnswer date) { @@ -169,7 +166,6 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getDefaultDate(), upsertInfo.getImageUrl() ); @@ -180,7 +176,6 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getImageUrl() ); } else if (question instanceof LongAnswer longAnswer) { @@ -190,7 +185,6 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getImageUrl() ); } else if (question instanceof NumberAnswer numberAnswer) { @@ -200,7 +194,15 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection(), + upsertInfo.getImageUrl() + ); + } else if (question instanceof Image image) { + image.updateQuestion( + upsertInfo.getTitle(), + upsertInfo.getDescription(), + upsertInfo.getIsRequired(), + upsertInfo.getQuestionOrder(), + upsertInfo.getSection(), upsertInfo.getImageUrl() ); } @@ -217,7 +219,6 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getDescription(), upsertInfo.getIsRequired(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getDefaultDate(), type, upsertInfo.getImageUrl() @@ -230,7 +231,6 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getDescription(), upsertInfo.getIsRequired(), upsertInfo.getSection(), - upsertInfo.getNextSection(), type, upsertInfo.getImageUrl() ); @@ -242,7 +242,6 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getDescription(), upsertInfo.getIsRequired(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getMaxValue(), upsertInfo.getMinValue(), upsertInfo.getRate(), @@ -257,7 +256,6 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getDescription(), upsertInfo.getIsRequired(), upsertInfo.getSection(), - upsertInfo.getNextSection(), upsertInfo.getMaxChoice(), upsertInfo.getHasNoneOption(), upsertInfo.getHasCustomInput(), @@ -273,7 +271,6 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getDescription(), upsertInfo.getIsRequired(), upsertInfo.getSection(), - upsertInfo.getNextSection(), type, upsertInfo.getImageUrl() ); @@ -285,7 +282,6 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getDescription(), upsertInfo.getIsRequired(), upsertInfo.getSection(), - upsertInfo.getNextSection(), type, upsertInfo.getImageUrl() ); @@ -297,7 +293,17 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getDescription(), upsertInfo.getIsRequired(), upsertInfo.getSection(), - upsertInfo.getNextSection(), + type, + upsertInfo.getImageUrl() + ); + } else if (QuestionType.IMAGE.equals(type)) { + return Image.of( + surveyId, + upsertInfo.getQuestionOrder(), + upsertInfo.getTitle(), + upsertInfo.getDescription(), + upsertInfo.getIsRequired(), + upsertInfo.getSection(), type, upsertInfo.getImageUrl() ); @@ -416,13 +422,11 @@ public List upsertSections(Long surveyId, List sectionDt .description(sectionDto.description()) .sectionOrder(sectionDto.order()) .nextSection(sectionDto.nextSection()) - .imageUrl(sectionDto.imageUrl()) .build(); } else { Section section = orderSectionMap.get(sectionDto.order()); section.updateSection( - sectionDto.title(), sectionDto.description(), sectionDto.order(), sectionDto.nextSection(), - sectionDto.imageUrl() + sectionDto.title(), sectionDto.description(), sectionDto.order(), sectionDto.nextSection() ); orderSectionMap.remove(sectionDto.order()); return section; diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/SurveyErrorCode.java b/src/main/java/OneQ/OnSurvey/domain/survey/SurveyErrorCode.java index dfad10ae..b913e471 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/SurveyErrorCode.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/SurveyErrorCode.java @@ -29,7 +29,8 @@ public enum SurveyErrorCode implements ApiErrorCode { SURVEY_ANSWER_INVALID("SURVEY_ANSWER_400", "설문 답변이 올바르지 않습니다.", HttpStatus.BAD_REQUEST), SURVEY_FREE_PROMOTION_NOT_ALLOWED("SURVEY_PROMOTION_400", "무료 설문은 프로모션 지급 대상이 아닙니다.", HttpStatus.BAD_REQUEST), - FORM_REQUEST_NOT_FOUND("FORM_REQUEST_404", "구글 폼 신청을 찾을 수 없습니다.", HttpStatus.NOT_FOUND); + FORM_REQUEST_NOT_FOUND("FORM_REQUEST_404", "구글 폼 신청을 찾을 수 없습니다.", HttpStatus.NOT_FOUND), + FORM_CONVERSION_FAILED("FORM_REQUEST_001", "구글 폼 변환에 실패했습니다.", HttpStatus.BAD_REQUEST); private final String errorCode; private final String message; diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/entity/Survey.java b/src/main/java/OneQ/OnSurvey/domain/survey/entity/Survey.java index c281f117..d1f09adb 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/entity/Survey.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/entity/Survey.java @@ -59,9 +59,6 @@ public class Survey extends BaseEntity { @Builder.Default private Boolean isFree = false; - @Column(name = "image_url", columnDefinition = "TEXT") - private String imageUrl; - public static Survey of( Long memberId, String title, @@ -87,14 +84,12 @@ public void updateSurvey( String title, String description, LocalDateTime deadline, - Integer totalCoin, - String imageUrl + Integer totalCoin ) { this.title = title; this.description = description; this.deadline = deadline; this.totalCoin = totalCoin; - this.imageUrl = imageUrl; } public void updateInterests(Set interests) { diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/dto/SurveyDetailData.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/dto/SurveyDetailData.java index c8f92dc5..c6ad943a 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/dto/SurveyDetailData.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/dto/SurveyDetailData.java @@ -20,7 +20,6 @@ public class SurveyDetailData { private String title; private String description; private LocalDateTime deadline; - private String imageUrl; // 설문 상세 정보 private Integer dueCount; diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/formRequest/FormConversionPayload.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/formRequest/FormConversionPayload.java new file mode 100644 index 00000000..6127c00f --- /dev/null +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/formRequest/FormConversionPayload.java @@ -0,0 +1,8 @@ +package OneQ.OnSurvey.domain.survey.model.formRequest; + +import java.util.List; + +public record FormConversionPayload ( + List urls +) { +} diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/formRequest/FormConversionResponse.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/formRequest/FormConversionResponse.java new file mode 100644 index 00000000..b1012944 --- /dev/null +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/formRequest/FormConversionResponse.java @@ -0,0 +1,76 @@ +package OneQ.OnSurvey.domain.survey.model.formRequest; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import java.util.List; + +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public record FormConversionResponse( + int totalCount, + int successCount, + List results, + String error +) { + + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public record Result( + String url, + String status, // "SUCCESS", "FAIL" + + // SUCCESS + Survey survey, + List unsupportedQuestions, + + // FAIL + String message + + ) { + public boolean isSuccess() { + return "SUCCESS".equals(status); + } + } + + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public record Survey( + String title, + String description, + List
sections + ) { } + + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public record Section( + String id, + int order, + String title, + String description, + Integer nextSectionOrder, + List questions + ) { } + + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public record Question( + String id, + String title, + String description, + String type, + boolean required, + List