-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SAMBAD-228] 모임원 답변 등록 시 리스트 요청 규격 수정 (#89)
* refactor: 질문 응답 시 질문 유형 필드 응답 추가 * refactor: 모임원 답변 등록 시 리스트로 받도록 수정 * refactor: 모임원 답변 리스트 저장 메서드 분리 (리뷰 반영)
- Loading branch information
Showing
13 changed files
with
580 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 12 additions & 6 deletions
18
...romeet/sambad/moring/meeting/answer/infrastructure/dto/MyMeetingAnswerResponseCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
package org.depromeet.sambad.moring.meeting.answer.infrastructure.dto; | ||
|
||
import org.depromeet.sambad.moring.meeting.answer.domain.MeetingAnswer; | ||
import org.depromeet.sambad.moring.meeting.comment.domain.comment.MeetingQuestionComment; | ||
import org.depromeet.sambad.moring.meeting.question.domain.MeetingQuestion; | ||
import java.util.List; | ||
|
||
import org.depromeet.sambad.moring.answer.domain.Answer; | ||
|
||
import com.querydsl.core.annotations.QueryProjection; | ||
|
||
public record MyMeetingAnswerResponseCustom( | ||
MeetingQuestion meetingQuestion, | ||
MeetingAnswer meetingAnswer, | ||
MeetingQuestionComment comment | ||
String meetingQuestionTitle, | ||
List<Answer> meetingAnswers, | ||
String comment | ||
) { | ||
|
||
@QueryProjection | ||
public MyMeetingAnswerResponseCustom { | ||
} | ||
|
||
public List<String> getMeetingAnswers() { | ||
return meetingAnswers.stream() | ||
.map(Answer::getContent) | ||
.toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
...org/depromeet/sambad/moring/meeting/answer/presentation/request/MeetingAnswerRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
package org.depromeet.sambad.moring.meeting.answer.presentation.request; | ||
|
||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*; | ||
|
||
import java.util.List; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
|
||
public record MeetingAnswerRequest( | ||
@Schema(example = "1", description = "선택한 답변 식별자") | ||
@Schema(description = "선택한 Answer ID 리스트", example = "[1, 2, 3]", requiredMode = REQUIRED) | ||
@Size(max = 9) | ||
@NotNull | ||
Long answerId | ||
List<Long> answerIds | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/org/depromeet/sambad/moring/question/domain/QuestionType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
package org.depromeet.sambad.moring.question.domain; | ||
|
||
import org.depromeet.sambad.moring.question.presentation.exception.AnswerCountOutOfRangeException; | ||
|
||
public enum QuestionType { | ||
SINGLE_CHOICE, MULTIPLE_SHORT_CHOICE, MULTIPLE_DESCRIPTIVE_CHOICE; | ||
|
||
private static final int MIN_ANSWER_COUNT = 1; | ||
private static final int MULTI_CHOICE_MAX_ANSWER_COUNT = 9; | ||
|
||
public static void validateAnswerCount(QuestionType questionType, int answerCount) { | ||
if (SINGLE_CHOICE.equals(questionType)) { | ||
if (answerCount != MIN_ANSWER_COUNT) { | ||
throw new AnswerCountOutOfRangeException(); | ||
} | ||
return; | ||
} | ||
if (answerCount < MIN_ANSWER_COUNT || answerCount > MULTI_CHOICE_MAX_ANSWER_COUNT) { | ||
throw new AnswerCountOutOfRangeException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.