Open
Conversation
- RecruitmentAnswer 엔티티 추가, 참여 요청 시 답변 저장 - 참여 요청자 본인의 지원 현황(답변 포함) 조회 기능 구현 - PENDING 상태의 참여 요청에 대한 답변 수정 기능 구현 - 답변 개수 불일치, 타 크루 질문 등 유효성 검증 로직 및 테스트 코드 추가
mandykr
reviewed
Sep 1, 2025
| return ApiResponse.ok(response); | ||
| } | ||
|
|
||
| @GetMapping("/{crewId}/demands/my-demand") |
Contributor
There was a problem hiding this comment.
uri "/{crewId}/demands/me" 제안드립니다
Comment on lines
+71
to
+73
| if (crew.getRecruitment().getRecruitmentQuestions().getValues().size() != request.answers().size()) { | ||
| throw new InvalidValueException(ErrorCode.MISMATCHED_ANSWER_COUNT); | ||
| } |
Comment on lines
+77
to
+83
| request.answers().forEach(answerRequest -> { | ||
| RecruitmentQuestion question = recruitmentQuestionRepository.findById(answerRequest.questionId()) | ||
| .orElseThrow(QuestionNotFoundException::new); | ||
|
|
||
| if (!question.getCrew().getId().equals(crewId)) { | ||
| throw new InvalidValueException(ErrorCode.INVALID_QUESTION_FOR_CREW); | ||
| } |
Contributor
There was a problem hiding this comment.
jpa 쓰기 지연이 작동하겠지만 반복문으로 repository 를 호출하는건 문제가 될 수 있어 보입니다. 한번에 목록으로 조회해서 적절한 책임을 갖는 객체에서 검증하는 것도 괜찮을것 같아요.
Comment on lines
+197
to
+201
| List<RecruitmentAnswer> newAnswers = request.answers().stream() | ||
| .map(answerRequest -> { | ||
| RecruitmentQuestion question = findRecruitmentQuestionByIdAndCrewId(answerRequest.questionId(), crewId); | ||
| return RecruitmentAnswer.of(demand, question, answerRequest.content()); | ||
| }).toList(); |
Contributor
There was a problem hiding this comment.
리스트를 다루는 로직은 아무래도 일급컬렉션을 사용하는게 깔끔해 보입니다.
Comment on lines
+18
to
+23
| public static UpdateDemandResponse from(Demand demand) { | ||
| return UpdateDemandResponse.builder() | ||
| .crewId(demand.getCrew().getId()) | ||
| .demandId(demand.getId()) | ||
| .build(); | ||
| } |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🔍 PR 타입 선택
아래 타입 중 해당하는 하나를 선택해 주세요. 반드시 하나만 선택해 주세요.
feat: 새로운 기능 추가fix: 버그 수정docs: 문서 수정style: 코드 포맷팅, 세미콜론 누락, 코드 변경이 없는 경우refactor: 코드 리팩토링test: 테스트 코드 추가 또는 수정chore: 빌드 업무 수정, 패키지 매니저 수정 등 기타 작업📝 변경 사항 요약
RecruitmentAnswer엔티티 추가: 참여 요청(Demand)에 대한 개별 답변 저장을 위한RecruitmentAnswer엔티티 및RecruitmentAnswerContentVO 추가POST /crews/{crewId}/demandsAPI를 통해 답변 목록을 함께 제출하고 저장하는 로직 구현GET /crews/{crewId}/demands/my-demandAPI를 통해 본인의 요청 상태 및 제출 답변 조회 기능 추가PENDING상태의 참여 요청에 한해, 본인 답변을 수정하는PUT /crews/{crewId}/demands/my-demandAPI 추가🛠 관련 이슈
Resolves: #49
Ref:
Related to:
close: #번호
추가 설명 (선택 사항)
PENDING상태에서만 가능하도록 제한하여 데이터 정합성 보장.Demand애그리거트가RecruitmentAnswer의 생명주기를 관리하도록 설계하여 DDD 원칙 준수.