Skip to content

refactor: 멘토 도메인 응답의 사용자 id를 siteUserId로 통일#665

Merged
Gyuhyeok99 merged 2 commits intosolid-connection:developfrom
Gyuhyeok99:refactor/663-mentor-site-user-id
Feb 14, 2026
Merged

refactor: 멘토 도메인 응답의 사용자 id를 siteUserId로 통일#665
Gyuhyeok99 merged 2 commits intosolid-connection:developfrom
Gyuhyeok99:refactor/663-mentor-site-user-id

Conversation

@Gyuhyeok99
Copy link
Contributor

관련 이슈

작업 내용

as is

  • siteuser_id, mentor_id로 응답값으로 나감

to be

  • siteuser_id만 응답값으로 나가도록 변경

특이 사항

리뷰 요구사항 (선택)

@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 2026

작업 개요

이 변경사항은 멘토 식별자 체계를 내부 멘토 ID에서 사이트 사용자 ID 기반으로 전환하는 리팩토링입니다. 다음과 같은 수정사항이 포함됩니다:

  1. 컨트롤러 엔드포인트 수정: /{mentor-id} 경로를 /{site-user-id}로 변경하고 해당 파라미터명 업데이트
  2. DTO 응답 변경: 네 개의 응답 클래스에서 mentor.getId()mentor.getSiteUserId() 변환
  3. 서비스 로직 개선: MentorQueryService와 MentoringCommandService의 멘토 조회 방식을 사이트 사용자 ID 기반으로 리팩토링
  4. 테스트 동기화: 모든 관련 테스트에서 ID 참조를 사이트 사용자 ID로 일관되게 업데이트

코드 리뷰 예상 소요 시간

🎯 3 (Moderate) | ⏱️ ~20 분

추천 리뷰어

  • wibaek
  • whqtker
  • lsy1307
  • Hexeong
🚥 Pre-merge checks | ✅ 5 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목은 멘토 도메인 응답의 사용자 id를 siteUserId로 통일하는 리팩터링이라는 변경의 핵심을 명확하게 전달합니다.
Description check ✅ Passed PR 설명에 관련 이슈와 작업 내용(as-is/to-be)이 포함되어 있으나, 특이 사항과 리뷰 요구사항 섹션은 비어있습니다.
Linked Issues check ✅ Passed 변경사항이 이슈 #663의 목표(멘토 응답에서 id를 siteUserId로 통일)를 충족하고 있습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 멘토 도메인의 id 필드를 siteUserId로 통일하는 리팩터링 범위 내에 있습니다.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into develop

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/main/java/com/example/solidconnection/mentor/controller/MentorController.java`:
- Around line 28-33: The controller changed the path variable meaning from
{mentor-id} to {site-user-id}, which breaks clients still passing the old
mentor-id; update MentorController.getMentorDetails to accept both legacy and
new path names by adding a dual mapping and resolving the value from the path
variable map: change `@GetMapping` to `@GetMapping`({"/{site-user-id}",
"/{mentor-id}"}) and replace the single `@PathVariable` parameter with
`@PathVariable` Map<String,String> pathVars, parse the id using
pathVars.getOrDefault("site-user-id", "mentor-id") (convert to long) and pass
that resolved mentorSiteUserId into mentorQueryService.getMentorDetails (also
add a short deprecation log when the legacy key "mentor-id" is used so we can
coordinate client rollout).
🧹 Nitpick comments (2)
src/main/java/com/example/solidconnection/mentor/service/MentoringCommandService.java (1)

34-38: MentoringApplyRequest.mentorId() 필드명을 mentorSiteUserId로 변경해주세요.

현재 코드에서 다음과 같은 이름 불일치가 발생하고 있습니다:

  1. DTO 필드명과 실제 의미의 괴리

    • MentoringApplyRequest의 필드는 mentorId로 정의되어 있습니다
    • 하지만 실제로는 mentor1.getSiteUserId()로 값이 전달되고 있습니다
    • 서비스 레이어에서도 mentorSiteUserId 변수로 명확하게 변환되어 사용됩니다
  2. 검증 메시지의 혼동 유발

    • 현재 검증 메시지는 "멘토 id를 입력해주세요"로 되어 있습니다
    • API 사용자에게 실제로는 siteUserId를 보내야 한다는 점이 명확하지 않습니다
  3. 미완성 리팩토링

    • 서비스 메서드의 변수명과 저장소 쿼리 메서드명(findBySiteUserId)이 명확하게 siteUserId를 지칭합니다
    • DTO 필드명도 이에 맞게 통일하는 것이 코드 일관성을 높입니다

필드명을 mentorSiteUserId로 변경하면 향후 유지보수와 API 이해도가 크게 개선될 것입니다.

src/test/java/com/example/solidconnection/mentor/service/MentorQueryServiceTest.java (1)

119-127: 변수명을 리팩터링 컨텍스트에 맞게 수정하면 좋겠습니다.

getMentorDetails의 첫 번째 파라미터가 이제 mentorSiteUserId를 받도록 변경되었으므로, 테스트의 변수명도 이에 맞추면 가독성이 향상됩니다.

♻️ 변수명 수정 제안
-            long notExistingMentorId = 999L;
+            long notExistingSiteUserId = 999L;

             // when & then
-            assertThatCode(() -> mentorQueryService.getMentorDetails(notExistingMentorId, siteUserFixture.사용자().getId()))
+            assertThatCode(() -> mentorQueryService.getMentorDetails(notExistingSiteUserId, siteUserFixture.사용자().getId()))

Comment on lines +28 to +33
@GetMapping("/{site-user-id}")
public ResponseEntity<MentorDetailResponse> getMentorDetails(
@AuthorizedUser long siteUserId,
@PathVariable("mentor-id") Long mentorId
@PathVariable("site-user-id") Long mentorSiteUserId
) {
MentorDetailResponse response = mentorQueryService.getMentorDetails(mentorId, siteUserId);
MentorDetailResponse response = mentorQueryService.getMentorDetails(mentorSiteUserId, siteUserId);
Copy link

@coderabbitai coderabbitai bot Feb 14, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

API 경로 변수 변경에 따른 하위 호환성 확인이 필요합니다.

  1. 엔드포인트가 /{mentor-id}/{site-user-id}로 변경되었습니다.
  2. URL 패턴 자체(/mentors/{value})는 동일하지만, 클라이언트가 전달해야 하는 ID 값의 의미가 내부 mentor ID에서 siteUserId로 바뀌었습니다.

기존 클라이언트(프론트엔드, 모바일 등)가 이전 응답에서 캐싱한 mentor ID를 사용하고 있다면 호환성 문제가 발생할 수 있으니, 클라이언트 측 배포 타이밍을 함께 조율해 주세요.

🤖 Prompt for AI Agents
In
`@src/main/java/com/example/solidconnection/mentor/controller/MentorController.java`
around lines 28 - 33, The controller changed the path variable meaning from
{mentor-id} to {site-user-id}, which breaks clients still passing the old
mentor-id; update MentorController.getMentorDetails to accept both legacy and
new path names by adding a dual mapping and resolving the value from the path
variable map: change `@GetMapping` to `@GetMapping`({"/{site-user-id}",
"/{mentor-id}"}) and replace the single `@PathVariable` parameter with
`@PathVariable` Map<String,String> pathVars, parse the id using
pathVars.getOrDefault("site-user-id", "mentor-id") (convert to long) and pass
that resolved mentorSiteUserId into mentorQueryService.getMentorDetails (also
add a short deprecation log when the legacy key "mentor-id" is used so we can
coordinate client rollout).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coderabbitai
그런 거 없는데 그냥 신경 안써도 되지 하위 호환성?

Copy link

Choose a reason for hiding this comment

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

@Gyuhyeok99 알겠습니다! 클라이언트 측 조율이나 배포 상황을 이미 파악하고 계신 것으로 이해했습니다. 불필요한 우려를 드려 죄송합니다. 👍

@Gyuhyeok99 Gyuhyeok99 merged commit 26f5a76 into solid-connection:develop Feb 14, 2026
2 checks passed
whqtker added a commit that referenced this pull request Feb 19, 2026
* feat: 파견 대학 테이블명 변경 및 협정 대학 테이블 추가하는 DDL 작성 (#620)

* feat: 파견 대학 테이블명 변경 및 협정 대학 테이블 추가하는 DDL 작성

* refactor: 테이블명 변경 및 추가에 따른 엔티티 생성

- 또한 목데이터 생성 로직 수정

* test: 테스트 코드에서 University -> HostUniversity로 변경

* chore: 중복 인덱스 생성 방지를 위해 인덱스 생성 제거

- FK 제약조건을 추가할 때 인덱스가 없다면 알아서 추가하기 때문

* chore: home_university 테이블에 created/updated_at 추가

* refactor: 잘못 설정되었던 테이블 간 연관 관계 재설정 (#622)

* refactor: home_university와 university_info_for_apply가 FK 관계를 가지도록

* chore: FK 변경에 따른 목데이터 수정

* test: 테스트 픽스터 수정

* refactor: 대학 검색 응답 수정 (#624)

* refactor: home_university와 university_info_for_apply가 FK 관계를 가지도록

* chore: FK 변경에 따른 목데이터 수정

* refactor: 필터 검색 엔드포인트 삭제

* refactor: 필터 검색 관련 서비스 로직 삭제

* refactor: 필터 검색 관련 레포지토리 메서드 삭제

* refactor: 필터 검색 관련 DTO 삭제

* test: 필터 검색 관련 테스트 코드 삭제

* refactor: 지원 대학 관련 응답에 협정 대학 이름 추가

* test: 지원 대학 응답 수정에 따른 테스트 수정

* refactor: 간접 참조 대신 연관관계 추가

- N+1 방지를 위해 fetch join도 추가

* test: 간접 참조 방식에서 연관 관계 설정으로 따른 테스트 코드 수정

* chore: 목데이터에서 지원 대학 테이블에 협정 대학 ID를 설정하도록

* test: home university fixture 추가

* refactor: home university에 대한 fetch join 추가

* refactor: s3 버전 업그레이드 및 로직 수정 (#608)

* refactor: s3 sdk 버전 업그레이드
- 의존성 수정
- 버전 업그레이드에 따른 코드 수정

* refactor: 이미지 이외의 파일 관리를 위해 ImgType 의미 명확하도록 수정
- ImgType에서 UploadType으로 변경
- 해당되는 파일 모두 수정

* refactor: s3 테스트 코드 추가

* fix: s3 access-key, secret-key 최신화, 버킷 명칭 올바르게 수정

* fix: ChatService Test 변경점 반영, S3ServiceTest 단위 테스트로 변경
- images->files로 디렉토리 경로 수정

* fix: 이중 비동기 실행문제 해결
- @async에 전적으로 위임

* refactor: S3Service error 메시지 NPE 가능성 제거

* refactor: 수정사항 반영
- UploadType -> UploadPath로 명칭변경
- 컨벤션 수정(미사용 변수 삭제, 들여쓰기, 명칭변경)

* fix: 테스트 코드 오류 수정
- 내부 로직에서 사용하는 fileUploadService 정의

* refactor: 수정사항 반영
- 파일 확장자 상수화
- 확장자 확인로직, 채팅이면 모든 파일 허용, 이미지 확인까지 모두 enum에서 관리
- MultipartFile이 비동기 과정에서 유실되지 않도록 byte로 변환해서 전달
- UrlPrefixResponse PascalCase로 변경

* refactor: 컨벤션 수정
- 사용하지 않는 import문 삭제

* refactor: 리프레시 토큰 만료시 쿠키 삭제 (#628)

* refactor: 리프레시 토큰 만료시 쿠키 삭제

* refactor: 인증 전용 예외 생성

* refactor: 멘토링 조회 응답에 mentoringId 필드 추가 (#638)

* feat: WebSocket 로깅 인터셉터 작성 (#635)

* feat: WebSocket 로깅 인터셉터 작성

* refactor: Principal 명시적 형 변환 대신 null 체크하여 형 변환

* feat: 어드민에서 파견 대학을 관리하도록 (#633)

* feat: 파견 대학 CRUD 관련 ErrorCode 추가

- HOST_UNIVERSITY_HAS_REFERENCES : 파견 대학 삭제 시 해당 대학을 참조하는 UnivApplyInfo가 존재하는 경우

* feat: 파견 대학 관련 정보를 업데이트하는 도메인 메서드 작성

* feat: 조회 관련 Repository 메서드 구현

* feat: 파견 대학 검색 관련 QueryDSL로 구현

* feat: 어드민 파견 대학 CRUD 관련 DTO 작성

* feat: country 조회 관련 로직 추가 및 ErrorCode 추가

* feat: 어드민 파견 대학 CRUD 관련 서비스 로직 작성

* feat: 어드민 파견 대학 관련 컨트롤러 작성

* test: 어드민 파견 대학 관리 관련 테스트 작성

* refactor: 엔드포인트의 path variable 이름 변경

- id -> host-university-id

* refactor: PageResponse 응답 객체를 사용하도록

* test: 응답 변경에 따른 테스트 코드 수정

* fix: host_university 테이블의 korean_name 필드에 unique key 추가 (#645)

* fix: host_university 테이블의 korean_name 필드에 unique key 쿠가

* test: test용 hostUniversityRepository 생성

* test: 고유한 korean_name을 가진 host university 객체를 사용하도록

* fix: 멘토 지원서 승인 시 유저 Role 을 Mentor로 승격 (#639)

* fix: 멘토 지원서 승인 시 유저 Role 을 Mentor로 승격

* fix: 멘토 지원서 승인 시 멘토 생성

* fix: 멘토의 introduction, passTip null 허용하도록 수정

- not null 인 필드에 빈문자열로 값을 채우는 것 보다, null 허용이 더 의미
  있다 판단하여 null 을 허용하도록 하였습니다.

* fix: 사용하지 않는  멘토 생성 api 제거

- 멘토 생성의 주체가 어드민으로 변경되어 Mentor 도메인의 Mentor 생성 api 를 제거

* feat: 멘토 지원서 승인 예외처리 추가

- 중복 멘토 생성 예외 처리 및 테스트 추가

* refactor: Mentor 생성 시 null 전달 제거

* refactor: 멘토 지원서 승낙 시, 검증 후 승격 및 멘토 생성

* chore: 스크립트 버전 수정 (#651)

* chore: 스크립트 버전 수정

* test: korean_name 컬럼 UK 관련 테스트 코드 수정

* feat: test skill 추가 (#647)

* feat: serena MCP 추가

* feat: test skill 추가

* feat: hook 추가

- 응답 대기시 알람발송
- 컨벤션 어겼을 때 훅 작동

* feat: 안쓰는 파일 제거

* fix: 게시글 중복 생성 방지 (#649)

* fix: 게시글 중복 생성 방지

- Redis 패키지 및 로직 정리

* fix: 게시글 중복 생성 방지

- 게시글 중복 요청 방지 Redis 로직 추가

* refactor: 게시글 중복 생성 방지

* chore: testcontainer 버전 업 (#659)

* chore: windows에서도 hook이 동작하도록 (#655)

* refactor: 오래된 이미지 삭제 후 이미지 pull하도록 변경 (#653)

refactor: 오래된 이미지 삭제 후 이미지 pull하도록 변경 (#653)

- 추가로 이미지는 5개 -> 2개 보관하도록 변경

* refactor: 멘토 도메인 응답의 사용자 id를 siteUserId로 통일 (#665)

* refactor: 멘토 관련 id응답은 모두 site-user-id가 되도록 수정

* test: 멘토 관련 테스트 코드 수정

* refactor: 채팅 도메인 응답의 사용자 관련 id를 siteUserId로 통일 (#666)

* refactor: 채팅 관련 응답에서 사용자 관련 Id를 siteUserId로 통일

* refactor: siteUserId를 포함하도록 서비스 코드 수정

* test: 사용자 id로 응답 통일 관련 테스트 수정

* feat: 전체 뉴스를 조회하는 API 구현 (#674)

* feat: 전체 news 조회 API 구현

- 기존 API에 author-id를 선택적으로 받도록

* test: 전체 news 조회 관련 테스트 코드 작성

* refactor: 날짜 오름차순으로 news 조회하는 JPA 메서드 추가

* refactor: 뉴스 조회 API를 하나로 통합

- 서비스 계층에서 siteUserId == null을 기준으로 분기하도록

* refactor: 컨트롤러 계층에서 분기문 제거

- 분기를 서비스 계층에게 위임했음

* test: 뉴스 조회 관련 테스트 코드 수정

* chore: 누락된 제약 조건을 추가하는 스크립트 작성 (#676)

---------

Co-authored-by: Yeon <84384499+lsy1307@users.noreply.github.com>
Co-authored-by: 황규혁 <126947828+Gyuhyeok99@users.noreply.github.com>
Co-authored-by: hyungjun <115551339+sukangpunch@users.noreply.github.com>
Co-authored-by: 정재희 <y2hjjh@naver.com>
@whqtker whqtker mentioned this pull request Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: 멘토 도메인 응답의 사용자 id를 siteUserId로 통일한다.

1 participant

Comments