diff --git a/moring-api/src/main/java/org/depromeet/sambad/moring/api/MoringApiApplication.java b/moring-api/src/main/java/org/depromeet/sambad/moring/api/MoringApiApplication.java index 65c46d35..9d67b0cf 100644 --- a/moring-api/src/main/java/org/depromeet/sambad/moring/api/MoringApiApplication.java +++ b/moring-api/src/main/java/org/depromeet/sambad/moring/api/MoringApiApplication.java @@ -1,13 +1,24 @@ package org.depromeet.sambad.moring.api; +import java.util.TimeZone; + import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import jakarta.annotation.PostConstruct; + @SpringBootApplication public class MoringApiApplication { + private static final String TIMEZONE_KST = "Asia/Seoul"; + public static void main(String[] args) { SpringApplication.run(MoringApiApplication.class, args); } + @PostConstruct + public void init() { + TimeZone.setDefault(TimeZone.getTimeZone(TIMEZONE_KST)); + } + } diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/MeetingAnswerQueryRepository.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/MeetingAnswerQueryRepository.java index 9959b467..cc6e37d2 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/MeetingAnswerQueryRepository.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/MeetingAnswerQueryRepository.java @@ -109,8 +109,7 @@ public MeetingAnswerListResponse findAllByOtherMeetingMemberId(Long meetingMembe .fetch(); List responseCustoms = meetingQuestions.stream() - .map(meetingQuestion -> new MeetingAnswerResponseCustom(meetingQuestion.getId(), - meetingQuestion.getTitle(), + .map(meetingQuestion -> new MeetingAnswerResponseCustom(meetingQuestion, getMyAnswers(meetingMemberId, meetingQuestion), getMyComment(meetingMemberId, meetingQuestion))) .toList(); @@ -130,8 +129,8 @@ public MyMeetingAnswerListResponse findAllByMyMeetingMemberId(Long meetingMember .fetch(); List responseCustoms = meetingQuestions.stream() - .map(meetingQuestion -> new MyMeetingAnswerResponseCustom(meetingQuestion.getId(), - meetingQuestion.getTitle(), + .map(meetingQuestion -> new MyMeetingAnswerResponseCustom( + meetingQuestion, getMyAnswers(meetingMemberId, meetingQuestion), getMyComment(meetingMemberId, meetingQuestion), isHidden(meetingQuestion, meetingMemberId) diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/dto/MeetingAnswerResponseCustom.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/dto/MeetingAnswerResponseCustom.java index e2b22406..64f524fa 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/dto/MeetingAnswerResponseCustom.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/dto/MeetingAnswerResponseCustom.java @@ -3,12 +3,12 @@ import java.util.List; import org.depromeet.sambad.moring.domain.answer.domain.Answer; +import org.depromeet.sambad.moring.domain.meeting.question.domain.MeetingQuestion; import com.querydsl.core.annotations.QueryProjection; public record MeetingAnswerResponseCustom( - Long meetingQuestionId, - String meetingQuestionTitle, + MeetingQuestion meetingQuestion, List meetingAnswers, String comment ) { diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/dto/MyMeetingAnswerResponseCustom.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/dto/MyMeetingAnswerResponseCustom.java index bb041085..afe69a0a 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/dto/MyMeetingAnswerResponseCustom.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/infrastructure/dto/MyMeetingAnswerResponseCustom.java @@ -3,12 +3,12 @@ import java.util.List; import org.depromeet.sambad.moring.domain.answer.domain.Answer; +import org.depromeet.sambad.moring.domain.meeting.question.domain.MeetingQuestion; import com.querydsl.core.annotations.QueryProjection; public record MyMeetingAnswerResponseCustom( - Long meetingQuestionId, - String meetingQuestionTitle, + MeetingQuestion meetingQuestion, List meetingAnswers, String comment, Boolean isHidden diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/presentation/response/MeetingAnswerListResponseDetail.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/presentation/response/MeetingAnswerListResponseDetail.java index 4449b66e..3f1625a0 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/presentation/response/MeetingAnswerListResponseDetail.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/presentation/response/MeetingAnswerListResponseDetail.java @@ -6,6 +6,8 @@ import java.util.stream.IntStream; import org.depromeet.sambad.moring.domain.meeting.answer.infrastructure.dto.MeetingAnswerResponseCustom; +import org.depromeet.sambad.moring.domain.meeting.question.domain.MeetingQuestion; +import org.depromeet.sambad.moring.domain.question.presentation.response.QuestionTitleResponse; import io.swagger.v3.oas.annotations.media.Schema; @@ -16,6 +18,9 @@ public record MeetingAnswerListResponseDetail( @Schema(title = "질문 인덱스", example = "1", requiredMode = REQUIRED) int idx, + @Schema(description = "질문 제목 정보", requiredMode = REQUIRED) + QuestionTitleResponse questionTitle, + @Schema(title = "릴레이 질문 제목", example = "갖고 싶은 초능력은?", requiredMode = REQUIRED) String title, @@ -31,10 +36,12 @@ public static List from(List { MeetingAnswerResponseCustom response = responseCustoms.get(i); + MeetingQuestion meetingQuestion = response.meetingQuestion(); return new MeetingAnswerListResponseDetail( - response.meetingQuestionId(), + meetingQuestion.getId(), i + 1, - response.meetingQuestionTitle(), + QuestionTitleResponse.from(meetingQuestion.getQuestion()), + meetingQuestion.getFullTitle(), response.getMeetingAnswers(), response.comment() ); diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/presentation/response/MyMeetingAnswerListResponseDetail.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/presentation/response/MyMeetingAnswerListResponseDetail.java index 8fd6090c..4448ccf3 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/presentation/response/MyMeetingAnswerListResponseDetail.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/answer/presentation/response/MyMeetingAnswerListResponseDetail.java @@ -6,6 +6,8 @@ import java.util.stream.IntStream; import org.depromeet.sambad.moring.domain.meeting.answer.infrastructure.dto.MyMeetingAnswerResponseCustom; +import org.depromeet.sambad.moring.domain.meeting.question.domain.MeetingQuestion; +import org.depromeet.sambad.moring.domain.question.presentation.response.QuestionTitleResponse; import io.swagger.v3.oas.annotations.media.Schema; @@ -16,6 +18,9 @@ public record MyMeetingAnswerListResponseDetail( @Schema(title = "질문 인덱스", example = "1", requiredMode = REQUIRED) int idx, + @Schema(description = "질문 제목 정보", requiredMode = REQUIRED) + QuestionTitleResponse questionTitle, + @Schema(title = "릴레이 질문 제목", example = "갖고 싶은 초능력은?", requiredMode = REQUIRED) String title, @@ -34,10 +39,12 @@ public static List from(List { MyMeetingAnswerResponseCustom response = responseCustoms.get(i); + MeetingQuestion meetingQuestion = response.meetingQuestion(); return new MyMeetingAnswerListResponseDetail( - response.meetingQuestionId(), + meetingQuestion.getId(), i + 1, - response.meetingQuestionTitle(), + QuestionTitleResponse.from(meetingQuestion.getQuestion()), + meetingQuestion.getFullTitle(), response.getMeetingAnswers(), response.comment(), response.isHidden() diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/member/presentation/response/MeetingMemberListResponse.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/member/presentation/response/MeetingMemberListResponse.java index e9a7b451..d92e8570 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/member/presentation/response/MeetingMemberListResponse.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/member/presentation/response/MeetingMemberListResponse.java @@ -23,10 +23,12 @@ public static MeetingMemberListResponse from( ) { List sortedHandWavedMembers = handWavedMembers.stream() .map(HandWavedMemberDto::handWavedMember) + .distinct() .sorted() .toList(); List sortedNotHandWavedMembers = notHandWavedMembers.stream() + .distinct() .sorted() .toList(); diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/domain/MeetingQuestion.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/domain/MeetingQuestion.java index 93dc5451..abb7fa0a 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/domain/MeetingQuestion.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/domain/MeetingQuestion.java @@ -201,4 +201,8 @@ private void validateTarget(MeetingMember targetMember) { throw new InvalidMeetingMemberTargetException(); } } + + public String getFullTitle() { + return question.getFullTitle(); + } } diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/CurrentMeetingQuestionResponse.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/CurrentMeetingQuestionResponse.java index e8b68628..2a5a624c 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/CurrentMeetingQuestionResponse.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/CurrentMeetingQuestionResponse.java @@ -7,6 +7,7 @@ import org.depromeet.sambad.moring.domain.meeting.member.domain.MeetingMember; import org.depromeet.sambad.moring.domain.meeting.member.presentation.response.MeetingMemberSummaryResponse; import org.depromeet.sambad.moring.domain.meeting.question.domain.MeetingQuestion; +import org.depromeet.sambad.moring.domain.question.presentation.response.QuestionTitleResponse; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -18,10 +19,13 @@ public record CurrentMeetingQuestionResponse( @FullFileUrl @Schema(example = "https://avatars.githubusercontent.com/u/173370739?v=4", description = "모임 질문 이미지 URL", - requiredMode = REQUIRED) + requiredMode = NOT_REQUIRED) String questionImageFileUrl, - @Schema(example = "갖고 싶은 초능력은?", description = "모임 질문 TITLE", requiredMode = REQUIRED) + @Schema(description = "질문 제목 정보", requiredMode = NOT_REQUIRED) + QuestionTitleResponse questionTitle, + + @Schema(example = "갖고 싶은 초능력은?", description = "모임 질문 TITLE", requiredMode = NOT_REQUIRED) String title, @Schema(example = "18", description = "모임 내 질문 인덱스로 1 부터 시작합니다.", requiredMode = REQUIRED) @@ -75,7 +79,8 @@ public static CurrentMeetingQuestionResponse questionRegisteredOf(MeetingQuestio return CurrentMeetingQuestionResponse.builder() .meetingQuestionId(meetingQuestion.getId()) .questionImageFileUrl(meetingQuestion.getQuestion().getQuestionImageUrl()) - .title(meetingQuestion.getQuestion().getTitle()) + .questionTitle(QuestionTitleResponse.from(meetingQuestion.getQuestion())) + .title(meetingQuestion.getFullTitle()) .questionNumber(meeting.getQuestionNumber(meetingQuestion)) .totalMeetingMemberCount(meeting.getTotalMemberCount()) .responseCount(meetingQuestion.getResponseCount()) diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/FullInactiveMeetingQuestionListResponseDetail.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/FullInactiveMeetingQuestionListResponseDetail.java index 77e1c915..5e6a35c7 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/FullInactiveMeetingQuestionListResponseDetail.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/FullInactiveMeetingQuestionListResponseDetail.java @@ -8,6 +8,7 @@ import org.depromeet.sambad.moring.domain.meeting.meeting.domain.Meeting; import org.depromeet.sambad.moring.domain.meeting.member.presentation.response.MeetingMemberSummaryResponse; import org.depromeet.sambad.moring.domain.meeting.question.domain.MeetingQuestion; +import org.depromeet.sambad.moring.domain.question.presentation.response.QuestionTitleResponse; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -22,6 +23,9 @@ public record FullInactiveMeetingQuestionListResponseDetail( requiredMode = REQUIRED) String questionImageFileUrl, + @Schema(description = "질문 제목 정보", requiredMode = REQUIRED) + QuestionTitleResponse questionTitle, + @Schema(example = "갖고 싶은 초능력은?", description = "모임 질문 TITLE", requiredMode = REQUIRED) String title, @@ -42,6 +46,7 @@ public static FullInactiveMeetingQuestionListResponseDetail from(MeetingQuestion return FullInactiveMeetingQuestionListResponseDetail.builder() .meetingQuestionId(meetingQuestion.getId()) .questionImageFileUrl(meetingQuestion.getQuestionImageUrl()) + .questionTitle(QuestionTitleResponse.from(meetingQuestion.getQuestion())) .title(meetingQuestion.getTitle()) .questionNumber(questionNumber) .startTime(meetingQuestion.getEpochMilliStartTime()) diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/MostInactiveMeetingQuestionListResponseDetail.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/MostInactiveMeetingQuestionListResponseDetail.java index 4327c399..b18223ea 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/MostInactiveMeetingQuestionListResponseDetail.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/meeting/question/presentation/response/MostInactiveMeetingQuestionListResponseDetail.java @@ -6,6 +6,7 @@ import org.depromeet.sambad.moring.domain.answer.domain.Answer; import org.depromeet.sambad.moring.domain.meeting.question.domain.MeetingQuestion; +import org.depromeet.sambad.moring.domain.question.presentation.response.QuestionTitleResponse; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; @@ -15,6 +16,9 @@ public record MostInactiveMeetingQuestionListResponseDetail( @Schema(example = "1", description = "모임 질문 식별자", requiredMode = REQUIRED) Long meetingQuestionId, + @Schema(description = "질문 제목 정보", requiredMode = REQUIRED) + QuestionTitleResponse questionTitle, + @Schema(example = "갖고 싶은 초능력은?", description = "모임 질문 TITLE", requiredMode = REQUIRED) String title, @@ -32,7 +36,8 @@ public static MostInactiveMeetingQuestionListResponseDetail of(MeetingQuestion m Optional bestAnswer) { return MostInactiveMeetingQuestionListResponseDetail.builder() .meetingQuestionId(meetingQuestion.getId()) - .title(meetingQuestion.getQuestion().getTitle()) + .questionTitle(QuestionTitleResponse.from(meetingQuestion.getQuestion())) + .title(meetingQuestion.getFullTitle()) .content(bestAnswer.isPresent() ? bestAnswer.get().getContent() : null) .engagementRate(meetingQuestion.calculateEngagementRate()) .startTime(meetingQuestion.getEpochMilliStartTime()) diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/application/QuestionService.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/application/QuestionService.java index a781407f..0f14e98f 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/application/QuestionService.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/application/QuestionService.java @@ -34,6 +34,7 @@ public void saveQuestion(QuestionRequest questionRequest) { FileEntity image = fileService.uploadAndSave(questionRequest.questionImageUrl()); Question question = Question.builder() .title(questionRequest.title()) + .subtitle(questionRequest.subtitle()) .questionImageFile(image) .questionType(questionRequest.questionType()) .answerContents(questionRequest.answerContents()) diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/domain/Question.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/domain/Question.java index ca39b079..5680e1c1 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/domain/Question.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/domain/Question.java @@ -40,6 +40,8 @@ public class Question extends BaseTimeEntity { @JoinColumn(name = "question_image_file_id") private FileEntity questionImageFile; + private String subtitle; + private String title; @Enumerated(EnumType.STRING) @@ -52,10 +54,13 @@ public class Question extends BaseTimeEntity { private List answers = new ArrayList<>(); @Builder - public Question(String title, FileEntity questionImageFile, QuestionType questionType, - List answerContents) { + public Question( + String subtitle, String title, FileEntity questionImageFile, QuestionType questionType, + List answerContents + ) { QuestionType.validateAnswerCount(questionType, answerContents.size()); this.questionType = questionType; + this.subtitle = subtitle; this.title = title; this.questionImageFile = questionImageFile; @@ -79,7 +84,7 @@ public String getQuestionImageUrl() { .orElse(null); } - public QuestionType getQuestionType() { - return questionType; + public String getFullTitle() { + return subtitle + " " + title; } } diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/domain/QuestionSummaryDto.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/domain/QuestionSummaryDto.java new file mode 100644 index 00000000..cb738585 --- /dev/null +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/domain/QuestionSummaryDto.java @@ -0,0 +1,13 @@ +package org.depromeet.sambad.moring.domain.question.domain; + +import com.querydsl.core.annotations.QueryProjection; + +public record QuestionSummaryDto( + Question question, + Long usedCount +) { + + @QueryProjection + public QuestionSummaryDto { + } +} diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/infrastructure/QuestionRepositoryImpl.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/infrastructure/QuestionRepositoryImpl.java index 1e4c66a0..546d047a 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/infrastructure/QuestionRepositoryImpl.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/infrastructure/QuestionRepositoryImpl.java @@ -11,8 +11,8 @@ import org.depromeet.sambad.moring.domain.common.response.PageableResponse; import org.depromeet.sambad.moring.domain.question.application.QuestionRepository; import org.depromeet.sambad.moring.domain.question.domain.Question; +import org.depromeet.sambad.moring.domain.question.domain.QuestionSummaryDto; import org.depromeet.sambad.moring.domain.question.presentation.response.QuestionListResponse; -import org.depromeet.sambad.moring.domain.question.presentation.response.QuestionSummaryResponse; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; @@ -45,12 +45,10 @@ public QuestionListResponse findQuestionsByMeetingId(Long meetingId, Pageable pa ) .fetch(); - List questionSummaryResponses = queryFactory + List questionSummaryResponses = queryFactory .select(Projections.constructor( - QuestionSummaryResponse.class, - question.id.as("questionId"), - question.questionImageFile.physicalPath.as("questionImageFileUrl"), - question.title, + QuestionSummaryDto.class, + question, as(select(meetingQuestion.count()) .from(meetingQuestion) .where(questionEq()), "usedCount") @@ -67,6 +65,7 @@ public QuestionListResponse findQuestionsByMeetingId(Long meetingId, Pageable pa .from(question) .where(question.id.notIn(usedQuestionIds)) .fetch(); + return QuestionListResponse.of(questionSummaryResponses, PageableResponse.of(pageable, totalElementIds)); } diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/request/QuestionRequest.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/request/QuestionRequest.java index 6719879a..6a59ba17 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/request/QuestionRequest.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/request/QuestionRequest.java @@ -11,6 +11,10 @@ import jakarta.validation.constraints.NotNull; public record QuestionRequest( + @Schema(description = "질문 부제목", example = "다음 중", requiredMode = REQUIRED) + @NotBlank + String subtitle, + @Schema(description = "질문 제목", example = "오늘의 질문은?", requiredMode = REQUIRED) @NotBlank String title, diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionListResponse.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionListResponse.java index e4df2d4b..52f8b45d 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionListResponse.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionListResponse.java @@ -5,6 +5,7 @@ import java.util.List; import org.depromeet.sambad.moring.domain.common.response.PageableResponse; +import org.depromeet.sambad.moring.domain.question.domain.QuestionSummaryDto; import io.swagger.v3.oas.annotations.media.Schema; @@ -19,8 +20,12 @@ public record QuestionListResponse( @Schema(description = "페이징 정보", requiredMode = REQUIRED) PageableResponse pageable ) { - public static QuestionListResponse of(List content, - PageableResponse pageableResponse) { - return new QuestionListResponse(content, pageableResponse); + public static QuestionListResponse of( + List dtoList, PageableResponse pageableResponse + ) { + List contents = dtoList.stream() + .map(QuestionSummaryResponse::from) + .toList(); + return new QuestionListResponse(contents, pageableResponse); } } diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionResponse.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionResponse.java index e44b696f..f5a740b1 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionResponse.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionResponse.java @@ -24,6 +24,9 @@ public record QuestionResponse( @Schema(description = "질문 이미지 URL", example = "https://example.com", requiredMode = REQUIRED) String questionImageFileUrl, + @Schema(description = "질문 제목 정보", requiredMode = REQUIRED) + QuestionTitleResponse questionTitle, + @Schema(description = "질문 제목", example = "갖고 싶은 초능력은?", requiredMode = REQUIRED) String title, @@ -36,6 +39,7 @@ public static QuestionResponse from(final Question question) { question.getId(), question.getQuestionType(), question.getQuestionImageUrl(), + QuestionTitleResponse.from(question), question.getTitle(), AnswerResponse.from(question.getAnswers()) ); diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionSummaryResponse.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionSummaryResponse.java index ae78956f..a330dc95 100644 --- a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionSummaryResponse.java +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionSummaryResponse.java @@ -3,6 +3,7 @@ import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*; import org.depromeet.sambad.moring.domain.file.presentation.annotation.FullFileUrl; +import org.depromeet.sambad.moring.domain.question.domain.QuestionSummaryDto; import com.querydsl.core.annotations.QueryProjection; @@ -16,6 +17,9 @@ public record QuestionSummaryResponse( @Schema(description = "질문 이미지 URL", example = "https://example.com", requiredMode = REQUIRED) String questionImageFileUrl, + @Schema(description = "질문 제목 정보", requiredMode = REQUIRED) + QuestionTitleResponse questionTitle, + @Schema(description = "질문 제목", example = "갖고 싶은 초능력은?", requiredMode = REQUIRED) String title, @@ -23,7 +27,14 @@ public record QuestionSummaryResponse( Long usedCount ) { - @QueryProjection - public QuestionSummaryResponse { + public static QuestionSummaryResponse from(QuestionSummaryDto dto) { + return new QuestionSummaryResponse( + dto.question().getId(), + dto.question().getQuestionImageFile().getPhysicalPath(), + QuestionTitleResponse.from(dto.question()), + dto.question().getFullTitle(), + dto.usedCount() + ); } + } diff --git a/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionTitleResponse.java b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionTitleResponse.java new file mode 100644 index 00000000..0af5279d --- /dev/null +++ b/moring-domain/src/main/java/org/depromeet/sambad/moring/domain/question/presentation/response/QuestionTitleResponse.java @@ -0,0 +1,23 @@ +package org.depromeet.sambad.moring.domain.question.presentation.response; + +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*; + +import org.depromeet.sambad.moring.domain.question.domain.Question; + +import io.swagger.v3.oas.annotations.media.Schema; + +public record QuestionTitleResponse( + @Schema(description = "질문 부제목", example = "제시된 초능력 중에", requiredMode= REQUIRED) + String subtitle, + + @Schema(description = "질문 제목", example = "갖고 싶은 초능력은?", requiredMode = REQUIRED) + String mainTitle, + + @Schema(description = "질문 전체 제목", example = "제시된 초능력 중에 갖고 싶은 초능력은?", requiredMode = REQUIRED) + String fullTitle +) { + + public static QuestionTitleResponse from(Question question) { + return new QuestionTitleResponse(question.getSubtitle(), question.getTitle(), question.getFullTitle()); + } +}