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 59b8f1e8..3d6b89de 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,6 +43,7 @@ public record SurveyInformationDto( String title, String description, String deadline, + String imageUrl, Set ages, String gender, String residence, @@ -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(), @@ -73,6 +75,7 @@ public record QuestionDto( Boolean isRequired, Integer questionOrder, Integer section, + String imageUrl, ChoicePropDto choiceProperty, RatingPropDto ratingProperty, DatePropDto dateProperty @@ -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()) @@ -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()); } } } @@ -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; @@ -160,7 +165,8 @@ public static SectionDto from(SurveySection vo) { vo.title(), vo.description(), vo.order(), - vo.nextSection() + vo.nextSection(), + vo.imageUrl() ); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/admin/application/AdminAuthService.java b/src/main/java/OneQ/OnSurvey/domain/admin/application/AdminAuthService.java index 2b575c6d..53316647 100644 --- a/src/main/java/OneQ/OnSurvey/domain/admin/application/AdminAuthService.java +++ b/src/main/java/OneQ/OnSurvey/domain/admin/application/AdminAuthService.java @@ -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; } diff --git a/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveyQuestion.java b/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveyQuestion.java index 5a3e9f75..2d0cbc75 100644 --- a/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveyQuestion.java +++ b/src/main/java/OneQ/OnSurvey/domain/admin/domain/model/survey/SurveyQuestion.java @@ -14,6 +14,7 @@ public record SurveyQuestion( Boolean isRequired, Integer questionOrder, Integer section, + String imageUrl, ChoiceProp choiceProperty, RatingProp ratingProperty, @@ -29,7 +30,8 @@ public record ChoiceProp ( ) { public record Option ( String content, - Integer nextSection + Integer nextSection, + String imageUrl ) {} } 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 1c9ffda2..a4e6add7 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,6 +5,7 @@ public record SurveySection ( String title, String description, Integer order, - Integer nextSection + Integer nextSection, + String imageUrl ) { } 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 2ddff995..f07dcc28 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,6 +8,7 @@ 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 591bf585..5f6048a4 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,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, @@ -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" -> { @@ -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() ) @@ -133,7 +136,8 @@ public static SurveySection toSurveySection(SectionDto sectionDto) { sectionDto.title(), sectionDto.description(), sectionDto.order(), - sectionDto.nextSection() + sectionDto.nextSection(), + sectionDto.imageUrl() ); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/entity/ChoiceOption.java b/src/main/java/OneQ/OnSurvey/domain/question/entity/ChoiceOption.java index a824017c..06a803db 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/ChoiceOption.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/ChoiceOption.java @@ -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) { 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 bfeec952..b7b43d0b 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/Question.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/Question.java @@ -49,13 +49,17 @@ 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; @@ -63,6 +67,7 @@ public void updateQuestion( this.order = order; this.section = (section != null) ? section : this.section; this.nextSection = nextSection; + this.imageUrl = imageUrl; } public void updateOrder(Integer order) { 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 6cdc6044..c13636d5 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/entity/Section.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/entity/Section.java @@ -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; } } 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 9ceeabc6..4f712ffc 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 @@ -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) @@ -64,6 +65,7 @@ public static Choice of( .hasCustomInput(hasCustomInput) .isSectionDecidable(isSectionDecidable) .type(type.name()) + .imageUrl(imageUrl) .build(); } @@ -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; 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 6b69ab8d..75e08fc5 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 @@ -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) @@ -44,6 +45,7 @@ public static DateAnswer of( .nextSection(nextSection) .defaultDate(defaultDate) .type(type.name()) + .imageUrl(imageUrl) .build(); } @@ -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; } } 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 760e03f3..d3d6a995 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 @@ -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) @@ -34,6 +35,7 @@ public static LongAnswer of( .type(type.name()) .section(section) .nextSection(nextSection) + .imageUrl(imageUrl) .build(); } @@ -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); } } 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 6c2256f9..f399aff8 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 @@ -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) @@ -34,6 +35,7 @@ public static NPS of( .type(type.name()) .section(section) .nextSection(nextSection) + .imageUrl(imageUrl) .build(); } @@ -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); } } 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 0be11b8a..aad2bd4f 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 @@ -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) @@ -34,6 +35,7 @@ public static NumberAnswer of( .type(type.name()) .section(section) .nextSection(nextSection) + .imageUrl(imageUrl) .build(); } @@ -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); } } 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 4e1de8ad..0077b426 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 @@ -36,7 +36,8 @@ public static Rating of( String maxValue, String minValue, Integer rate, - QuestionType type + QuestionType type, + String imageUrl ) { return Rating.builder() .surveyId(surveyId) @@ -50,6 +51,7 @@ public static Rating of( .minValue(minValue) .rate(rate) .type(type.name()) + .imageUrl(imageUrl) .build(); } @@ -62,9 +64,10 @@ public void updateQuestion( Integer nextSection, String maxValue, String minValue, - Integer rate + Integer rate, + String imageUrl ) { - super.updateQuestion(title, description, isRequired, order, section, nextSection); + super.updateQuestion(title, description, isRequired, order, section, nextSection, 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 28edc043..cb36f754 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 @@ -23,7 +23,8 @@ public static ShortAnswer of( Boolean isRequired, Integer section, Integer nextSection, - QuestionType type + QuestionType type, + String imageUrl ) { return ShortAnswer.builder() .surveyId(surveyId) @@ -34,6 +35,7 @@ public static ShortAnswer of( .section(section) .nextSection(nextSection) .type(type.name()) + .imageUrl(imageUrl) .build(); } @@ -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); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/OptionDto.java b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/OptionDto.java index ebb0fed3..b01ec1fc 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/model/dto/OptionDto.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/model/dto/OptionDto.java @@ -11,6 +11,7 @@ public class OptionDto { private Long questionId; private String content; private Integer nextSection; + private String imageUrl; public static OptionDto fromEntity(ChoiceOption choiceOption) { return OptionDto.builder() @@ -18,6 +19,7 @@ public static OptionDto fromEntity(ChoiceOption choiceOption) { .questionId(choiceOption.getQuestionId()) .content(choiceOption.getContent()) .nextSection(choiceOption.getNextSection()) + .imageUrl(choiceOption.getImageUrl()) .build(); } } 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 b2b6899a..3abfcd2b 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 @@ -31,6 +31,8 @@ public static class UpsertInfo { // 임시 필드 Integer nextSection; + String imageUrl; + // Choice 필드 Integer maxChoice; Boolean hasNoneOption; @@ -56,7 +58,8 @@ public static UpsertInfo fromEntity(Question question) { .isRequired(question.getIsRequired()) .questionOrder(question.getOrder()) .section(question.getSection()) - .questionType(QuestionType.valueOf(question.getType())); + .questionType(QuestionType.valueOf(question.getType())) + .imageUrl(question.getImageUrl()); return switch (QuestionType.valueOf(question.getType())) { case 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 2d84c418..eabbaeaa 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,7 +8,8 @@ public record SectionDto ( String title, String description, Integer order, - Integer nextSection + Integer nextSection, + String imageUrl ) { public static SectionDto fromEntity(Section section) { @@ -17,7 +18,8 @@ public static SectionDto fromEntity(Section section) { section.getTitle(), section.getDescription(), section.getSectionOrder(), - section.getNextSection() + section.getNextSection(), + section.getImageUrl() ); } 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 8e6fae28..60a20a98 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 @@ -35,6 +35,7 @@ public static ChoiceDto fromEntity(Choice choice) { .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 0f5d5287..41313e89 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 @@ -26,6 +26,7 @@ public static DateDto fromEntity(DateAnswer date) { .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 06934655..af78a370 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 @@ -46,6 +46,8 @@ public class DefaultQuestionDto { // 임시 필드 private Integer nextSection; + private String imageUrl; + public static DefaultQuestionDto fromEntity(Question question) { return DefaultQuestionDto.builder() .questionId(question.getQuestionId()) @@ -57,6 +59,7 @@ public static DefaultQuestionDto fromEntity(Question question) { .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 14938a8f..720c7d2f 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 @@ -28,6 +28,7 @@ public static RatingDto fromEntity(Rating rating) { .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 ff97b679..c5191ab5 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,7 +36,8 @@ public SectionDto findSectionDtoBySurveyIdAndOrder(long surveyId, int order) { section.title, section.description, section.sectionOrder, - section.nextSection + section.nextSection, + section.imageUrl )) .from(section) .where( @@ -53,7 +54,8 @@ public List findAllSectionDtoBySurveyId(long surveyId) { section.title, section.description, section.sectionOrder, - section.nextSection + section.nextSection, + section.imageUrl )) .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 c4140483..d0843fe0 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionCommandService.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionCommandService.java @@ -136,7 +136,8 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getMaxChoice(), upsertInfo.getHasNoneOption(), upsertInfo.getHasCustomInput(), - upsertInfo.getIsSectionDecidable() + upsertInfo.getIsSectionDecidable(), + upsertInfo.getImageUrl() ); } else if (question instanceof Rating rating) { rating.updateQuestion( @@ -148,7 +149,8 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getNextSection(), upsertInfo.getMaxValue(), upsertInfo.getMinValue(), - upsertInfo.getRate() + upsertInfo.getRate(), + upsertInfo.getImageUrl() ); } else if (question instanceof NPS nps) { nps.updateQuestion( @@ -157,7 +159,8 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection() + upsertInfo.getNextSection(), + upsertInfo.getImageUrl() ); } else if (question instanceof DateAnswer date) { date.updateQuestion( @@ -167,7 +170,8 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getQuestionOrder(), upsertInfo.getSection(), upsertInfo.getNextSection(), - upsertInfo.getDefaultDate() + upsertInfo.getDefaultDate(), + upsertInfo.getImageUrl() ); } else if (question instanceof ShortAnswer shortAnswer) { shortAnswer.updateQuestion( @@ -176,7 +180,8 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection() + upsertInfo.getNextSection(), + upsertInfo.getImageUrl() ); } else if (question instanceof LongAnswer longAnswer) { longAnswer.updateQuestion( @@ -185,7 +190,8 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection() + upsertInfo.getNextSection(), + upsertInfo.getImageUrl() ); } else if (question instanceof NumberAnswer numberAnswer) { numberAnswer.updateQuestion( @@ -194,7 +200,8 @@ private void updateQuestion(QuestionUpsertDto.UpsertInfo upsertInfo, Question qu upsertInfo.getIsRequired(), upsertInfo.getQuestionOrder(), upsertInfo.getSection(), - upsertInfo.getNextSection() + upsertInfo.getNextSection(), + upsertInfo.getImageUrl() ); } } @@ -212,7 +219,8 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getSection(), upsertInfo.getNextSection(), upsertInfo.getDefaultDate(), - type + type, + upsertInfo.getImageUrl() ); } else if (QuestionType.NPS.equals(type)) { return NPS.of( @@ -223,7 +231,8 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getIsRequired(), upsertInfo.getSection(), upsertInfo.getNextSection(), - type + type, + upsertInfo.getImageUrl() ); } else if (QuestionType.RATING.equals(type)) { return Rating.of( @@ -237,7 +246,8 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getMaxValue(), upsertInfo.getMinValue(), upsertInfo.getRate(), - type + type, + upsertInfo.getImageUrl() ); } else if (QuestionType.CHOICE.equals(type)) { return Choice.of( @@ -252,7 +262,8 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getHasNoneOption(), upsertInfo.getHasCustomInput(), upsertInfo.getIsSectionDecidable(), - type + type, + upsertInfo.getImageUrl() ); } else if (QuestionType.SHORT.equals(type)) { return ShortAnswer.of( @@ -263,7 +274,8 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getIsRequired(), upsertInfo.getSection(), upsertInfo.getNextSection(), - type + type, + upsertInfo.getImageUrl() ); } else if (QuestionType.LONG.equals(type)) { return LongAnswer.of( @@ -274,7 +286,8 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getIsRequired(), upsertInfo.getSection(), upsertInfo.getNextSection(), - type + type, + upsertInfo.getImageUrl() ); } else if (QuestionType.NUMBER.equals(type)) { return NumberAnswer.of( @@ -285,7 +298,8 @@ private Question createQuestion(Long surveyId, QuestionUpsertDto.UpsertInfo upse upsertInfo.getIsRequired(), upsertInfo.getSection(), upsertInfo.getNextSection(), - type + type, + upsertInfo.getImageUrl() ); } else { throw new CustomException(ErrorCode.INVALID_REQUEST); @@ -346,7 +360,8 @@ public List upsertChoiceOptionList(List upsert OptionDto optionInfo = updateInfoMap.get(id); option.updateOption( optionInfo.getContent(), - optionInfo.getNextSection() + optionInfo.getNextSection(), + optionInfo.getImageUrl() ); }); @@ -355,7 +370,8 @@ public List upsertChoiceOptionList(List upsert .map(upsertInfo -> ChoiceOption.of( questionId, upsertInfo.getContent(), - upsertInfo.getNextSection() + upsertInfo.getNextSection(), + upsertInfo.getImageUrl() )).toList(); finalList.addAll(updateList); @@ -400,11 +416,13 @@ 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.title(), sectionDto.description(), sectionDto.order(), sectionDto.nextSection(), + sectionDto.imageUrl() ); orderSectionMap.remove(sectionDto.order()); return section; diff --git a/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionConverter.java b/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionConverter.java index abd387b7..8f625d13 100644 --- a/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionConverter.java +++ b/src/main/java/OneQ/OnSurvey/domain/question/service/QuestionConverter.java @@ -40,7 +40,8 @@ private static QuestionUpsertDto.UpsertInfo toUpsertInfo(DefaultQuestionDto dto) .isRequired(dto.getIsRequired()) .questionOrder(dto.getQuestionOrder()) .questionType(QuestionType.valueOf(dto.getQuestionType())) - .section(dto.getSection() != null ? dto.getSection() : 1); // section이 null인 경우 기본값 1 설정 + .section(dto.getSection() != null ? dto.getSection() : 1) // section이 null인 경우 기본값 1 설정 + .imageUrl(dto.getImageUrl()); // 2. 타입별 특정 필드 매핑 switch (dto) { @@ -52,7 +53,8 @@ private static QuestionUpsertDto.UpsertInfo toUpsertInfo(DefaultQuestionDto dto) OptionDto.builder() .optionId(option.getOptionId()) .content(option.getContent()) - .nextSection(option.getNextSection()).build() + .nextSection(option.getNextSection()) + .imageUrl(option.getImageUrl()).build() ).toList() ); case RatingDto ratingDto -> builder.minValue(ratingDto.getMinValue()) 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 d1f09adb..c281f117 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/entity/Survey.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/entity/Survey.java @@ -59,6 +59,9 @@ 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, @@ -84,12 +87,14 @@ public void updateSurvey( String title, String description, LocalDateTime deadline, - Integer totalCoin + Integer totalCoin, + String imageUrl ) { 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 c6ad943a..c8f92dc5 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,6 +20,7 @@ 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/request/FreeSurveyFormRequest.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/request/FreeSurveyFormRequest.java index f7f7e2b3..1b819284 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/request/FreeSurveyFormRequest.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/request/FreeSurveyFormRequest.java @@ -2,11 +2,15 @@ import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Future; +import jakarta.validation.constraints.Pattern; import java.time.LocalDateTime; public record FreeSurveyFormRequest( @Future @Schema(description = "설문 마감일", example = "2026-12-31T23:59:59") - LocalDateTime deadline + LocalDateTime deadline, + @Schema(description = "설문 이미지 URL") + @Pattern(regexp = "^(https?)://.+$", message = "imageUrl은 http/https URL 형식이어야 합니다.") + String imageUrl ) {} diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SectionRequest.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SectionRequest.java index 4b2153cd..7cbd3bf7 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SectionRequest.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SectionRequest.java @@ -12,7 +12,8 @@ public record SectionInfo ( String title, String description, Integer order, - Integer nextSection + Integer nextSection, + String imageUrl ) { } public List toDto() { @@ -21,7 +22,8 @@ public List toDto() { sectionInfo.title(), sectionInfo.description(), sectionInfo.order(), - sectionInfo.nextSection() + sectionInfo.nextSection(), + sectionInfo.imageUrl() )).toList(); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SurveyFormCreateRequest.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SurveyFormCreateRequest.java index 461132f7..2b7e8566 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SurveyFormCreateRequest.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SurveyFormCreateRequest.java @@ -6,6 +6,8 @@ public record SurveyFormCreateRequest( @Schema(description = "설문 제목", example = "설문1") String title, @Schema(description = "설문 설명", example = "설문1에 대한 설명입니다.") - String description + String description, + @Schema(description = "설문 이미지 url", example = "https://example.com/survey1.png") + String imageUrl ) { } diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SurveyFormRequest.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SurveyFormRequest.java index a2729b5a..122d863e 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SurveyFormRequest.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/request/SurveyFormRequest.java @@ -35,6 +35,9 @@ public record SurveyFormRequest( Integer dueCountPrice, @Schema(description = "총 코인", example = "10000") - Integer totalCoin + Integer totalCoin, + + @Schema(description = "설문 이미지 URL") + String imageUrl ) { } \ No newline at end of file diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/response/ParticipationInfoResponse.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/response/ParticipationInfoResponse.java index 4d4e7bac..915c58da 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/response/ParticipationInfoResponse.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/response/ParticipationInfoResponse.java @@ -17,7 +17,8 @@ public record ParticipationInfoResponse( boolean isScreenRequired, boolean isScreened, boolean isSurveyResponded, - Boolean isFree + Boolean isFree, + String imageUrl ) { public static ParticipationInfoResponse from( Survey survey, int responseCount, ParticipationStatus participationStatus @@ -32,7 +33,8 @@ public static ParticipationInfoResponse from( participationStatus.isScreenRequired(), participationStatus.isScreened(), participationStatus.isSurveyResponded(), - survey.getIsFree() + survey.getIsFree(), + survey.getImageUrl() ); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/response/ParticipationQuestionResponse.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/response/ParticipationQuestionResponse.java index 6070ed65..1dc2946f 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/response/ParticipationQuestionResponse.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/response/ParticipationQuestionResponse.java @@ -7,6 +7,7 @@ public record ParticipationQuestionResponse( String sectionTitle, String sectionDescription, + String sectionImageUrl, Integer currSection, Integer nextSection, List info @@ -15,7 +16,7 @@ public static ParticipationQuestionResponse of( List info ) { return new ParticipationQuestionResponse( - null, null, + null, null, null, 1, 0, info ); @@ -29,7 +30,23 @@ public static ParticipationQuestionResponse of( List info ) { return new ParticipationQuestionResponse( - title, description, + title, description, null, + currSection != null ? currSection : 1, + currSection != null ? nextSection : 0, + info + ); + } + + public static ParticipationQuestionResponse of( + String title, + String description, + String imageUrl, + Integer currSection, + Integer nextSection, + List info + ) { + return new ParticipationQuestionResponse( + title, description, imageUrl, currSection != null ? currSection : 1, currSection != null ? nextSection : 0, info diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/response/SurveyDetailResponse.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/response/SurveyDetailResponse.java index ba541833..cc830a26 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/response/SurveyDetailResponse.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/response/SurveyDetailResponse.java @@ -14,7 +14,8 @@ public record SurveyDetailResponse( int totalCoin, @DateFormat LocalDateTime createdAt, @DateFormat LocalDateTime deadline, - SurveyInfoResponse surveyInfo + SurveyInfoResponse surveyInfo, + String imageUrl ) { public static SurveyDetailResponse from(Survey survey, SurveyInfo info) { return new SurveyDetailResponse( @@ -24,7 +25,8 @@ public static SurveyDetailResponse from(Survey survey, SurveyInfo info) { survey.getTotalCoin(), survey.getCreatedAt(), survey.getDeadline(), - SurveyInfoResponse.from(info) + SurveyInfoResponse.from(info), + survey.getImageUrl() ); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/model/response/SurveyFormResponse.java b/src/main/java/OneQ/OnSurvey/domain/survey/model/response/SurveyFormResponse.java index 2ca34f2e..ee982a9e 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/model/response/SurveyFormResponse.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/model/response/SurveyFormResponse.java @@ -11,7 +11,8 @@ public record SurveyFormResponse ( String title, String description, Integer totalCoin, - LocalDateTime createdAt + LocalDateTime createdAt, + String imageUrl ) { public static SurveyFormResponse fromEntity(Survey survey) { @@ -21,6 +22,7 @@ public static SurveyFormResponse fromEntity(Survey survey) { .description(survey.getDescription()) .totalCoin(survey.getTotalCoin()) .createdAt(survey.getCreatedAt()) + .imageUrl(survey.getImageUrl()) .build(); } } diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepositoryImpl.java b/src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepositoryImpl.java index 795da163..aaee20bf 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepositoryImpl.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepositoryImpl.java @@ -169,6 +169,7 @@ public SurveyDetailData getSurveyDetailDataById(Long surveyId) { survey.title, survey.description, survey.deadline, + survey.imageUrl, surveyInfo.dueCount, set(ageAlias).as("ages"), surveyInfo.gender, diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/service/command/SurveyCommandService.java b/src/main/java/OneQ/OnSurvey/domain/survey/service/command/SurveyCommandService.java index 23fd6350..8a2c0c40 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/service/command/SurveyCommandService.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/service/command/SurveyCommandService.java @@ -39,6 +39,7 @@ import java.time.Duration; import java.time.LocalDateTime; import java.util.HashSet; +import java.util.Objects; import java.util.Set; import static OneQ.OnSurvey.domain.survey.model.SurveyStatus.REFUNDED; @@ -98,8 +99,8 @@ public SurveyFormResponse upsertSurvey(Long memberId, Long surveyId, SurveyFormC } if (survey.getTitle().equals(request.title()) && survey.getDescription().equals(request.description()) + && Objects.equals(survey.getImageUrl(), request.imageUrl()) ) { - log.info("[SURVEY:COMMAND:upsertSurvey] 설문 수정 사항 없음 - surveyId={}", surveyId); return SurveyFormResponse.fromEntity(survey); } @@ -107,7 +108,8 @@ public SurveyFormResponse upsertSurvey(Long memberId, Long surveyId, SurveyFormC request.title(), request.description(), survey.getDeadline(), - survey.getTotalCoin() + survey.getTotalCoin(), + request.imageUrl() ); survey = surveyRepository.save(survey); log.info("[SURVEY:COMMAND:upsertSurvey] 설문 수정 완료 - surveyId={}", surveyId); @@ -123,7 +125,7 @@ public SurveyFormResponse submitSurvey(Long userKey, Long surveyId, SurveyFormRe Set ages = (request.ages() == null) ? Set.of() : new HashSet<>(request.ages()); - survey.updateSurvey(survey.getTitle(), survey.getDescription(), request.deadline(), request.totalCoin()); + survey.updateSurvey(survey.getTitle(), survey.getDescription(), request.deadline(), request.totalCoin(), request.imageUrl()); SurveyInfo info = upsertSurveyInfo( surveyId, @@ -150,7 +152,7 @@ public SurveyFormResponse submitFreeSurvey(Long userKey, Long surveyId, FreeSurv validateMember(userKey); survey.markFree(); - survey.updateSurvey(survey.getTitle(), survey.getDescription(), request.deadline(), 0); + survey.updateSurvey(survey.getTitle(), survey.getDescription(), request.deadline(), 0, request.imageUrl()); SurveyInfo info = upsertSurveyInfo( surveyId, diff --git a/src/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQueryService.java b/src/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQueryService.java index 68dc5040..f2e72fbb 100644 --- a/src/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQueryService.java +++ b/src/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQueryService.java @@ -279,7 +279,8 @@ public ParticipationQuestionResponse getParticipationQuestionInfo(Long surveyId, return section != null ? ParticipationQuestionResponse.of( - section.title(), section.description(), section.order(), section.nextSection(), questionDtoList + section.title(), section.description(), section.imageUrl(), + section.order(), section.nextSection(), questionDtoList ) : ParticipationQuestionResponse.of(questionDtoList); } diff --git a/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/controller/ImageController.java b/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/controller/ImageController.java index 701a0df6..90c24560 100644 --- a/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/controller/ImageController.java +++ b/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/controller/ImageController.java @@ -1,6 +1,6 @@ package OneQ.OnSurvey.global.infra.ncp.objectStorage.image.controller; -import OneQ.OnSurvey.global.auth.custom.CustomUserDetails; +import OneQ.OnSurvey.global.auth.custom.Authenticatable; import OneQ.OnSurvey.global.common.response.SuccessResponse; import OneQ.OnSurvey.global.infra.ncp.objectStorage.image.dto.ImageUploadResponse; import OneQ.OnSurvey.global.infra.ncp.objectStorage.image.service.ImageModifyService; @@ -8,10 +8,12 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; import lombok.RequiredArgsConstructor; +import OneQ.OnSurvey.global.infra.ncp.objectStorage.image.enums.ImageSubFolder; import org.springframework.http.MediaType; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -30,9 +32,11 @@ public SuccessResponse upload( schema = @Schema(type = "string", format = "binary")) @RequestPart("file") MultipartFile file, - @AuthenticationPrincipal CustomUserDetails principal + @RequestParam(required = false, defaultValue = "MEMBER") ImageSubFolder context, + + @AuthenticationPrincipal Authenticatable principal ) { - ImageUploadResponse res = imageModifyService.upload(file, principal.getUserKey()); + ImageUploadResponse res = imageModifyService.upload(file, principal.getUserKey(), context); return SuccessResponse.ok(res); } } \ No newline at end of file diff --git a/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/enums/ImageSubFolder.java b/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/enums/ImageSubFolder.java index 7bb964a9..8ddb1fdc 100644 --- a/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/enums/ImageSubFolder.java +++ b/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/enums/ImageSubFolder.java @@ -1,7 +1,8 @@ package OneQ.OnSurvey.global.infra.ncp.objectStorage.image.enums; public enum ImageSubFolder { - MEMBER; + MEMBER, + SURVEY; public String dir() { return name().toLowerCase(); diff --git a/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/service/ImageModifyService.java b/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/service/ImageModifyService.java index 486ab640..21418cd7 100644 --- a/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/service/ImageModifyService.java +++ b/src/main/java/OneQ/OnSurvey/global/infra/ncp/objectStorage/image/service/ImageModifyService.java @@ -44,10 +44,13 @@ public class ImageModifyService { private final NcpPublicUrlStrategy urlStrategy; public ImageUploadResponse upload(MultipartFile file, Long userKey) { + return upload(file, userKey, ImageSubFolder.MEMBER); + } + + public ImageUploadResponse upload(MultipartFile file, Long userKey, ImageSubFolder sub) { validate(file); ImageRootFolder root = ImageRootFolder.PUBLIC; - ImageSubFolder sub = ImageSubFolder.MEMBER; String objectKey = ObjectKeyFactory.build(root, sub, userKey, file.getOriginalFilename()); String contentType = chooseContentType(file); diff --git a/src/main/resources/templates/bo/survey.html b/src/main/resources/templates/bo/survey.html index c3e2714f..e8218d32 100644 --- a/src/main/resources/templates/bo/survey.html +++ b/src/main/resources/templates/bo/survey.html @@ -33,6 +33,17 @@ white-space: pre-wrap; overflow-y: auto; } + /* 하이퍼링크 미리보기 */ + .desc-html-preview a, + .option-text-html-preview a { + color: #4f46e5; + text-decoration: underline; + font-weight: 500; + } + .desc-html-preview a:hover, + .option-text-html-preview a:hover { + color: #3730a3; + } @@ -168,9 +179,27 @@

-
+
+
+ + +
+ +
@@ -384,7 +413,26 @@

+

설문 대표 이미지 (선택)

+

설문 목록에서 표시될 대표 이미지를 설정합니다.

+
+ + +
+ + + + +

예상 비용

@@ -580,6 +628,27 @@

선택된 새 소유자

+ + +