-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SAMBAD-228] 모임원 답변 등록 시 리스트 요청 규격 수정 #89
Merged
nahyeon99
merged 3 commits into
develop
from
feature/SAMBAD-228-fix_bug_and_request_dto_type
Aug 7, 2024
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
원자적인 작업으로 수행될 수 있는 메서드로 빼는게 좋아보이는데, 어떻게 생각하시나요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메서드가 무거워 보이긴 하네요. 분리 했습니다! 🚀