Skip to content

Conversation

@nayonsoso
Copy link
Collaborator

@nayonsoso nayonsoso commented Jul 28, 2025

관련 이슈

작업 내용

  • mentor 테이블에 String term 컬럼 추가했습니다.
  • 고민한 부분 :
    • 이제 term 을 사용하는 곳이 두군데가 되었다.. (Mentor, UnivApplyInfo)
      이걸 계속 string 으로 관리해도 되는걸까? 테이블로 분리? 아니면 enum으로?
    • 하지만 term 은 오만군데에 사용되므로 table로 관리하면 join으로 인한 성능 저하의 파장이 꽤나 클수도..
    • enum 으로 관리하자니, 그럼 새로운 학기마다 추가 배포 필요. 번거로움
    • table로 관리하면 나~중에 멘토 검색 기능이 더 구체적으로 바뀌어 “파견 학기” 필터링 검색이 추가된다면 year = 2024 같은 조건을 사용할 수 있으므로 유연하긴 할듯
    • 모르겠다 일단 String 으로 구현하자..

여기에 대해 의견 주시면 감사하겠습니다 👯‍♀️

특이 사항

리뷰 요구사항 (선택)

@coderabbitai
Copy link

coderabbitai bot commented Jul 28, 2025

Walkthrough

  1. Mentor 엔티티에 새로운 필드 추가
     - Mentor 클래스에 term(String, 최대 50자, not null) 필드가 새롭게 등장했습니다.

  2. Mentor 관련 DTO 구조 변경
     - MentorDetailResponse, MentorMyPageResponse, MentorPreviewResponse 세 가지 DTO에서 기존의 exchangeStatus 필드가 삭제되고, 그 자리에 term(String) 필드가 추가되었습니다.
     - 각 DTO의 정적 팩토리 메서드도 이에 맞춰 exchangeStatus 대신 term 값을 받아오도록 수정되었습니다.

  3. MentorPreviewsResponse DTO 삭제
     - MentorPreviewResponse 리스트와 nextPageNumber를 담던 MentorPreviewsResponse 레코드가 완전히 삭제되었습니다.

  4. 데이터베이스 스키마 변경
     - mentor 테이블에 term(varchar(50), not null) 컬럼이 추가되는 마이그레이션 스크립트가 새로 작성되었습니다.

  5. 테스트용 MentorFixtureBuilder 개선
     - MentorFixtureBuilder에 term 필드(기본값 "2025-1")가 추가되고, 이를 설정할 수 있는 setter 메서드가 생겼습니다.
     - create() 메서드에서 Mentor 인스턴스를 만들 때 term 값이 함께 전달되도록 변경되었습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

  • 변경 범위는 주로 엔티티, DTO, 테스트 픽스처, 마이그레이션 스크립트에 집중되어 있습니다.
  • DTO 구조 변경과 관련 팩토리 메서드 수정, 그리고 DB 스키마 변경이 포함되어 있어 중간 정도의 리뷰 시간이 예상됩니다.

Suggested reviewers

  • Gyuhyeok99
  • wibaek

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 0

🧹 Nitpick comments (1)
src/main/java/com/example/solidconnection/mentor/domain/Mentor.java (1)

47-48: 새로운 term 필드 추가가 적절합니다.

  1. 데이터베이스 제약조건과 일치: length = 50, nullable = false 설정이 마이그레이션 스크립트와 정확히 일치합니다.
  2. 불변성 설계: setter 메서드가 없어 생성 후 변경이 불가능한 설계로, 파견 학기 정보의 일관성을 보장합니다.

다만 학기 형식 검증을 고려해보시는 것은 어떨까요? 예를 들어 "2025-1", "2025-2" 같은 패턴 검증을 추가하면 데이터 품질을 더욱 향상시킬 수 있을 것 같습니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66aa670 and 35ac57c.

📒 Files selected for processing (7)
  • src/main/java/com/example/solidconnection/mentor/domain/Mentor.java (1 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentorDetailResponse.java (2 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentorMyPageResponse.java (2 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentorPreviewResponse.java (2 hunks)
  • src/main/java/com/example/solidconnection/mentor/dto/MentorPreviewsResponse.java (0 hunks)
  • src/main/resources/db/migration/V26__add_term_column_to_mentor.sql (1 hunks)
  • src/test/java/com/example/solidconnection/mentor/fixture/MentorFixtureBuilder.java (3 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/example/solidconnection/mentor/dto/MentorPreviewsResponse.java
🔇 Additional comments (10)
src/main/resources/db/migration/V26__add_term_column_to_mentor.sql (1)

1-2: 기존 mentor 레코드 확인 필요

  1. NOT NULL 제약조건 추가
    – 기존 데이터가 있는 상태에서 컬럼을 NOT NULL로 추가하면 마이그레이션이 실패할 수 있습니다.
  2. 기본값 미지정
    – 새로 추가된 컬럼에 대한 기본값 또는 데이터 초기화 로직이 포함되어 있지 않아 기존 레코드는 NULL을 허용하지 않습니다.

아래 스크립트를 실제 DB 접속 정보로 수정해 실행하시고, mentor 테이블의 레코드 수를 확인해주세요:

#!/bin/bash
echo "기존 mentor 레코드 수 조회..."
mysql -u <username> -p<password> <database_name> -e "SELECT COUNT(*) AS mentor_count FROM mentor;"

확인 결과가 0이 아니라면, 기본값 설정 또는 별도 데이터 마이그레이션 스크립트를 추가로 작성하는 방안을 고려해 주세요.

src/test/java/com/example/solidconnection/mentor/fixture/MentorFixtureBuilder.java (3)

20-20: 기본값 설정이 현실적입니다.

테스트용 기본값 "2025-1"이 현재 학기를 반영하여 적절합니다.


56-59: Builder 패턴 일관성이 잘 유지되었습니다.

기존 setter 메서드들과 동일한 패턴으로 구현되어 일관성이 좋습니다.


70-70: 생성자 파라미터 순서가 올바릅니다.

term 필드가 적절한 위치에 추가되어 Mentor 엔티티 생성 시 올바른 값이 전달됩니다.

src/main/java/com/example/solidconnection/mentor/dto/MentorMyPageResponse.java (2)

13-13: DTO 필드 타입 변경이 적절합니다.

ExchangeStatus exchangeStatus에서 String term으로의 변경이 요구사항과 정확히 일치합니다.


27-27: 데이터 소스 변경이 올바르게 적용되었습니다.

  1. 기존: siteUser.getExchangeStatus()에서 상태 정보 조회
  2. 변경: mentor.getTerm()에서 파견 학기 정보 직접 조회

이제 멘토 엔티티에서 직접 파견 학기 정보를 관리하므로 더 명확한 데이터 구조입니다.

src/main/java/com/example/solidconnection/mentor/dto/MentorPreviewResponse.java (2)

13-13: 일관된 DTO 구조 변경입니다.

다른 DTO들과 동일한 패턴으로 ExchangeStatus에서 String term으로 변경되어 일관성이 잘 유지되었습니다.


28-28: 데이터 소스 통일이 완료되었습니다.

  1. MentorMyPageResponse와 동일한 패턴으로 mentor.getTerm() 사용
  2. 일관성: 모든 멘토 관련 DTO에서 동일한 방식으로 파견 학기 정보 조회

전체 시스템에서 파견 학기 정보의 출처가 통일되어 유지보수성이 향상되었습니다.

src/main/java/com/example/solidconnection/mentor/dto/MentorDetailResponse.java (2)

13-13: 필드 변경사항이 적절합니다.

  1. ExchangeStatus exchangeStatus에서 String term으로의 변경이 PR 목표와 일치합니다.
  2. 파견 상태 대신 파견 학기 정보를 제공하도록 개선되었습니다.
  3. String 타입 선택으로 유연성을 확보했습니다.

29-29: 팩토리 메서드 업데이트가 올바릅니다.

  1. mentor.getTerm() 호출로 새로운 필드와 일관성을 유지합니다.
  2. 이전 SiteUser에서 exchangeStatus를 가져오던 방식에서 변경되었습니다.
  3. Mentor 엔티티의 새로운 term 필드를 적절히 활용하고 있습니다.

Copy link
Contributor

@Gyuhyeok99 Gyuhyeok99 left a comment

Choose a reason for hiding this comment

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

Flyway 잘 작성되어있습니다!(앞으로 저도 꼼꼼히 확인하겠습니다..)

저는 이렇게 주기적으로 추가되는 데이터는 별도 테이블로 관리하는 게 더 좋다고 생각합니다.
저희는 단일 서버를 사용하고 있어서, 학기 하나 추가할 때마다 서버를 재배포하는 건 효율적이지 않은 것 같습니다..

물론 join이 한 번 더 발생하긴 하지만, 전체적인 trade-off를 고려했을 때는 확장성과 운영 편의성 측면에서 테이블 분리 쪽이 더 유리하다고 생각합니다!

Copy link
Member

@whqtker whqtker left a comment

Choose a reason for hiding this comment

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

음 저도 나중에는 테이블로 관리하는 편이 더 좋을 것 같습니다 !

@nayonsoso
Copy link
Collaborator Author

@Gyuhyeok99 @whqtker 의견 감사드립니다😊

물론 join이 한 번 더 발생하긴 하지만, 전체적인 trade-off를 고려했을 때는 확장성과 운영 편의성 측면에서 테이블 분리 쪽이 더 유리하다고 생각합니다!

특히 규혁님이 말씀하신 이 부분 덕분에 저도 table로 마음이 더 기울었습니다.
term을 테이블로 관리하는 것은 큰 변경이 될 것 같으니, 우선 이슈로 만들어두었습니다. #418

@nayonsoso nayonsoso merged commit d8710a0 into solid-connection:develop Jul 30, 2025
2 checks passed
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: 멘토가 '파견 학기'를 갖도록

3 participants