-
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.
- Loading branch information
Showing
10 changed files
with
90 additions
and
54 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
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(); | ||
} | ||
} | ||
} |