Hotfix/#204 멘토 담당 프로젝트 조회 API를 담당 대회/담당 팀 조회로 분리#206
Hidden character warning
Conversation
There was a problem hiding this comment.
Pull request overview
This hotfix refactors the mentor “assigned projects” query into two mentor-centric endpoints that better match the UI flow (select contest → load teams), consolidates mentor endpoints under a single /mentors controller, and updates DTOs/docs/tests accordingly.
Changes:
- Split
GET /contests/mentors/me/projectsintoGET /mentors/me/contests(per-contest aggregates) andGET /mentors/me/contests/{contestId}/teams(per-team list). - Consolidate mentor endpoints into
MentorControllerand move team submissions endpoint under/mentors/me/.... - Replace
MentorProjectsResponsewithMentorContestResponse, encapsulateContestMemberRepositoryaccess viaContestMemberConvenience, and update RestDocs + integration tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/opus/opus/restdocs/RestDocsTest.java | Switch RestDocs WebMvcTest wiring from old mentor controller/service to MentorController/MentorQueryService. |
| src/test/java/com/opus/opus/restdocs/docs/MentorApiDocsTest.java | Update RestDocs scenarios/snippets for new mentor endpoints and role scope. |
| src/test/java/com/opus/opus/contest/application/MentorQueryServiceTest.java | Update integration tests for contest/team split + new failure cases. |
| src/main/java/com/opus/opus/modules/contest/application/MentorQueryService.java | Implement new “mentor contests” + “mentor contest teams” query methods and per-contest aggregation. |
| src/main/java/com/opus/opus/modules/contest/application/dto/response/MentorProjectsResponse.java | Remove legacy combined response DTO. |
| src/main/java/com/opus/opus/modules/contest/application/dto/response/MentorContestResponse.java | Add new per-contest aggregate response DTO. |
| src/main/java/com/opus/opus/modules/contest/application/convenience/ContestMemberConvenience.java | Add repository encapsulation methods for mentor assignment lookups. |
| src/main/java/com/opus/opus/modules/contest/api/MentorController.java | Add consolidated /mentors controller with the new endpoints. |
| src/main/java/com/opus/opus/modules/contest/api/ContestMentorController.java | Remove legacy /contests/... mentor controller. |
| src/main/java/com/opus/opus/docs/asciidoc/mentor.adoc | Update public API documentation to match the split endpoints and new snippets. |
Comments suppressed due to low confidence (2)
src/main/java/com/opus/opus/modules/contest/application/MentorQueryService.java:53
getMentorContests가ContestMember가 존재하지만teamIds가 비어 있는 경우(팀 배정이 아직 없거나 모두 삭제된 경우)에도 대회를 그대로 반환합니다. PR/문서 상 ‘담당(배정된) 대회 목록’의 의미가 ‘담당 팀이 있는 대회’라면, 빈 팀 배정 레코드는 목록에서 제외하는 편이 API 의미를 명확히 하고 프론트에서 0팀 대회가 노출되는 문제를 막을 수 있습니다.
src/main/java/com/opus/opus/modules/contest/application/MentorQueryService.java:96getMentorContests는 대회(ContestMember)마다 카테고리 조회, 팀 조회, 트랙 조회, pending-feedback 집계를 각각 별도 쿼리로 수행합니다(getValidateExistCategory,getTeamsByIds,getValidateExistTracks,findPendingFeedbackCountsByTeams). 담당 대회 수가 늘면 요청당 쿼리 수가 선형으로 증가하므로, 카테고리/트랙/팀을 contestId·categoryId 기준으로 배치 로딩하거나 집계용 전용 repository 쿼리(조인+group by)로 한 번에 가져오는 방식으로 최적화하는 것이 안전합니다.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
그런데 제가 알기론 ContestMentor라는 entity가 없는 걸로 알고 있는데 단독 Controller를 가지도록 설계된 부분이 저희 convention과 맞지 않는 것 같습니다. CRUD를 가지고 있지도 않고요! 멘토의 기능은 ContestMember와 연관되어 있는 걸로 파악하고 있습니다. (Contest와 Member의 중간 테이블이며, memberId로 멤버의 권한을 판별함. 이름은 모든 멤버가 다 들어가는 것 같지만.. 현재는 기획상 Contest를 관리하는 멤버. 즉, 교수와 외부멘토만 이 테이블에 들어감)
이 부분 수정이 필요해 보입니다! 하지만 Hotfix이니 동작에 문제가 없으면 머지해주시면 될 것 같습니다. (본 PR에서 고치셔도 되고 다음 릴리즈에 들어간다면 issue로 작성해두시면 좋을 것 같아요)
🔥 연관된 이슈
close: #204
📜 작업 내용
GET /contests/mentors/me/projects)를 2개의 API로 분리했습니다.GET /mentors/me/contests— 멘토 담당 대회 목록 조회 (대회별 담당 분과명 목록·검토 대기 건수 합계·담당 팀 수 집계)GET /mentors/me/contests/{contestId}/teams— 선택 대회의 담당 팀(프로젝트) 목록 조회 (팀별 피드백 대기 건수 포함)MentorController(/mentors)로 통합했습니다.ContestMentorController의 팀 제출물 조회도 이동:GET /contests/{contestId}/teams/{teamId}/submissions→GET /mentors/me/contests/{contestId}/teams/{teamId}/submissions(프론트 URL 변경 필요)ContestMentorQueryService→MentorQueryService로 리네임ROLE_외부멘토전용으로 정리했습니다. (ROLE_교수제거)ContestMemberRepository직접 사용을ContestMemberConvenience신규 메서드(getAssignedContestMembers,getValidateExistContestMember)로 캡슐화했습니다.MentorProjectsResponse는 삭제하고, 대회 집계용MentorContestResponse를 추가했습니다. 두 API 모두 목록 조회 컨벤션에 맞춰 배열로 반환합니다.💬 리뷰 요구사항
X
✨ 기타