Skip to content

Hotfix/#204 멘토 담당 프로젝트 조회 API를 담당 대회/담당 팀 조회로 분리#206

Merged
pykido merged 1 commit into
mainfrom
Hotfix/#204_멘토-담당-프로젝트-조회-API-대회-팀-분리
Jul 4, 2026

Hidden character warning

The head ref may contain hidden characters: "Hotfix/#204_\uba58\ud1a0-\ub2f4\ub2f9-\ud504\ub85c\uc81d\ud2b8-\uc870\ud68c-API-\ub300\ud68c-\ud300-\ubd84\ub9ac"
Merged

Hotfix/#204 멘토 담당 프로젝트 조회 API를 담당 대회/담당 팀 조회로 분리#206
pykido merged 1 commit into
mainfrom
Hotfix/#204_멘토-담당-프로젝트-조회-API-대회-팀-분리

Conversation

@pykido

@pykido pykido commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🔥 연관된 이슈

close: #204

📜 작업 내용

#205 (develop 대상)와 동일한 작업사항을 main에 바로 반영하기 위한 Hotfix PR입니다.

  • 멘토 담당 프로젝트 조회 API(GET /contests/mentors/me/projects)를 2개의 API로 분리했습니다.
    • API 1 GET /mentors/me/contests — 멘토 담당 대회 목록 조회 (대회별 담당 분과명 목록·검토 대기 건수 합계·담당 팀 수 집계)
    • API 2 GET /mentors/me/contests/{contestId}/teams — 선택 대회의 담당 팀(프로젝트) 목록 조회 (팀별 피드백 대기 건수 포함)
  • 멘토 도메인 컨트롤러를 MentorController(/mentors)로 통합했습니다.
    • 기존 ContestMentorController의 팀 제출물 조회도 이동: GET /contests/{contestId}/teams/{teamId}/submissionsGET /mentors/me/contests/{contestId}/teams/{teamId}/submissions (프론트 URL 변경 필요)
    • 서비스도 ContestMentorQueryServiceMentorQueryService로 리네임
  • 교수이면서 외부멘토일 수 없으므로 멘토 API 권한을 ROLE_외부멘토 전용으로 정리했습니다. (ROLE_교수 제거)
  • ContestMemberRepository 직접 사용을 ContestMemberConvenience 신규 메서드(getAssignedContestMembers, getValidateExistContestMember)로 캡슐화했습니다.
  • 기존 통합 응답 DTO MentorProjectsResponse는 삭제하고, 대회 집계용 MentorContestResponse를 추가했습니다. 두 API 모두 목록 조회 컨벤션에 맞춰 배열로 반환합니다.

💬 리뷰 요구사항

X

✨ 기타

  • 감사합니다-!

@pykido pykido self-assigned this Jul 4, 2026
@pykido pykido added ‼️P1 우선순위 매우 높음 🔍 기능 수정 기능 일부 수정 (오류 수정, 기획 변경 등) labels Jul 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/projects into GET /mentors/me/contests (per-contest aggregates) and GET /mentors/me/contests/{contestId}/teams (per-team list).
  • Consolidate mentor endpoints into MentorController and move team submissions endpoint under /mentors/me/....
  • Replace MentorProjectsResponse with MentorContestResponse, encapsulate ContestMemberRepository access via ContestMemberConvenience, 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

  • getMentorContestsContestMember가 존재하지만 teamIds가 비어 있는 경우(팀 배정이 아직 없거나 모두 삭제된 경우)에도 대회를 그대로 반환합니다. PR/문서 상 ‘담당(배정된) 대회 목록’의 의미가 ‘담당 팀이 있는 대회’라면, 빈 팀 배정 레코드는 목록에서 제외하는 편이 API 의미를 명확히 하고 프론트에서 0팀 대회가 노출되는 문제를 막을 수 있습니다.
    src/main/java/com/opus/opus/modules/contest/application/MentorQueryService.java:96
  • getMentorContests는 대회(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.

@JJimini JJimini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그런데 제가 알기론 ContestMentor라는 entity가 없는 걸로 알고 있는데 단독 Controller를 가지도록 설계된 부분이 저희 convention과 맞지 않는 것 같습니다. CRUD를 가지고 있지도 않고요! 멘토의 기능은 ContestMember와 연관되어 있는 걸로 파악하고 있습니다. (Contest와 Member의 중간 테이블이며, memberId로 멤버의 권한을 판별함. 이름은 모든 멤버가 다 들어가는 것 같지만.. 현재는 기획상 Contest를 관리하는 멤버. 즉, 교수와 외부멘토만 이 테이블에 들어감)

이 부분 수정이 필요해 보입니다! 하지만 Hotfix이니 동작에 문제가 없으면 머지해주시면 될 것 같습니다. (본 PR에서 고치셔도 되고 다음 릴리즈에 들어간다면 issue로 작성해두시면 좋을 것 같아요)

@pykido
pykido merged commit 96e0082 into main Jul 4, 2026
1 check passed
@pykido
pykido deleted the Hotfix/#204_멘토-담당-프로젝트-조회-API-대회-팀-분리 branch July 4, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

‼️P1 우선순위 매우 높음 🔍 기능 수정 기능 일부 수정 (오류 수정, 기획 변경 등)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants