Skip to content

Conversation

@lsy1307
Copy link
Contributor

@lsy1307 lsy1307 commented Jul 3, 2025

관련 이슈

작업 내용

  • Board, Comment, Post, PostLike 도메인의 연관관계 수정
  • 엔티티 생성자 parameter 수정으로 인한 Repository, Service 수정 및 테스트 코드 수정 다수

특이사항

  • 제 이전 PR과의 충돌을 미연에 방지하고자 이전 branch의 커밋에서 이어서 작업하였습니다.

리뷰 요구사항 (선택)

  • 이번에도 최대한 기존 코드에 영향을 미치지 않도록 작업하였으나 혹시나 로직상 문제가 생길 수 있는 부분 위주로 체크해주시면 감사하겠습니다!

lsy1307 added 10 commits July 1, 2025 15:39
- Application, Country, GpaScore, InterestedCountry/Region, LanguageTestScore, LikedUniversity. SiteUser, UnivApplyInfo 도메인 수정
- 연관관계 삭제 및 생성자 parameter 수정으로 인한 쿼리 수정 다수
- test코드 수정
- 연관관계 변경에 따른 transaction 문제 해결
- 쿼리 일부 수정, 테스트 코드 일부 수정
- GeneralUniversityRecommendService 로직 수정
- ScoreService에서 siteUser정보를 다시 불러오는 로직 삭제
- 컨벤션, 타입수정 다수
- Board, Comment, Post, PostLike 연관관계 수정/삭제
- 연관관계 수정에 따른 Repository및 Service 레이어 수정
- 연관관계 수정에 따른 테스트 코드 수정
@lsy1307 lsy1307 self-assigned this Jul 3, 2025
@lsy1307 lsy1307 requested a review from wibaek as a code owner July 3, 2025 16:13
@coderabbitai
Copy link

coderabbitai bot commented Jul 3, 2025

Walkthrough

  1. Board, Post, SiteUser 엔티티의 관계 단순화
    • Board, Post, SiteUser 엔티티에서 서로 간의 연관관계(예: postList, commentList, postLikeList, board, siteUser 등)를 모두 제거하고, 각 엔티티는 상대 엔티티의 ID나 코드만을 필드로 가지도록 변경되었습니다.
  2. 엔티티 메서드 및 필드 시그니처 변경
    • 연관관계 객체를 직접 주고받던 setter 메서드들은 이제 ID나 코드 값을 인자로 받도록 바뀌었습니다. 예를 들어, setBoardAndSiteUser(Board, SiteUser) → setBoardAndSiteUserId(String, long) 등으로 변경되었습니다.
  3. JPA 연관관계 어노테이션 및 EntityGraph 제거
  4. Repository, Service 계층의 쿼리 및 메서드 파라미터 변경
    • Repository 계층의 메서드들은 엔티티 객체 대신 ID 기반 파라미터로 변경되었고, Service 계층에서도 연관 엔티티 객체를 직접 주입하는 방식에서 ID 기반 조회 및 비교로 로직이 바뀌었습니다.
  5. DTO, 테스트 코드 내 연관관계 변경 반영
    • DTO 및 테스트 코드에서도 기존에 엔티티 객체를 넘기던 부분이 ID 또는 코드 기반으로 수정되었으며, getter 호출 방식도 getSiteUser().getId() → getSiteUserId() 등으로 변경되었습니다.
  6. Board, Post 등 엔티티의 fetch 전략 및 쿼리 변경
    • Board와 Post 관련 쿼리에서 연관 엔티티를 fetch join 하던 부분이 제거되어 기본 fetch 전략(지연 로딩 등)으로 동작하게 변경되었습니다.
  7. 예외 처리 및 소유권 검증 로직 단순화
    • 소유자 검증 등에서 객체 비교 대신 ID 값 비교(Objects.equals 등)로 로직이 간소화되었습니다.

Suggested reviewers

  • wibaek
  • Gyuhyeok99
  • nayonsoso

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5f6bcaf and 5b58a39.

📒 Files selected for processing (1)
  • src/main/java/com/example/solidconnection/siteuser/domain/SiteUser.java (0 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/example/solidconnection/siteuser/domain/SiteUser.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings

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

🔭 Outside diff range comments (2)
src/main/java/com/example/solidconnection/application/domain/Application.java (1)

79-90: 생성자에서 null 검증 추가 필요

모든 생성자에서 siteUser.getId()를 호출하는데, siteUser가 null인 경우 NPE가 발생할 수 있습니다.

각 생성자에 null 검증을 추가하세요:

 public Application(
         SiteUser siteUser,
         Gpa gpa,
         LanguageTest languageTest,
         String term) {
+    if (siteUser == null || siteUser.getId() == null) {
+        throw new IllegalArgumentException("SiteUser는 필수입니다");
+    }
     this.siteUserId = siteUser.getId();
src/main/java/com/example/solidconnection/community/comment/domain/Comment.java (1)

90-99: 메서드명 변경 제안

resetPostAndSiteUserAndParentComment() 메서드명에 여전히 "SiteUser"가 포함되어 있지만, 실제로는 siteUserId를 리셋하지 않습니다. 메서드명을 resetPostAndParentComment()로 변경하는 것이 더 명확할 것 같습니다.

-public void resetPostAndSiteUserAndParentComment() {
+public void resetPostAndParentComment() {
🧹 Nitpick comments (6)
src/main/java/com/example/solidconnection/community/post/domain/PostLike.java (1)

39-44: reset 메서드 완성도 개선

resetPostAndSiteUser 메서드가 사용자 ID는 초기화하지 않고 있습니다. 메서드명과 일관성을 위해 사용자 ID도 함께 초기화하는 것이 좋겠습니다.

     public void resetPostAndSiteUser() {
         if (this.post != null) {
             this.post.getPostLikeList().remove(this);
         }
         this.post = null;
+        this.siteUserId = 0L;
     }
src/main/java/com/example/solidconnection/location/country/domain/Country.java (1)

24-25: regionCode 필드 검증 추가 고려

regionCode 필드에 대한 유효성 검증이 없습니다. 잘못된 코드가 저장될 수 있으므로 생성자나 setter에서 검증 로직을 추가하는 것이 좋겠습니다.

검증 로직 추가 예시:

 @Column(name="region_code")
 private String regionCode;
+
+private void validateRegionCode(String regionCode) {
+    if (regionCode == null || regionCode.trim().isEmpty()) {
+        throw new IllegalArgumentException("Region code cannot be null or empty");
+    }
+}
src/main/java/com/example/solidconnection/score/domain/GpaScore.java (1)

40-40: 데이터베이스 제약 조건 추가를 고려해 보세요.

siteUserId 필드가 primitive long 타입으로 선언되어 있어 null이 될 수 없습니다. 데이터베이스 무결성을 위해 @Column 어노테이션을 추가하여 NOT NULL 제약을 명시하는 것이 좋겠습니다.

-    private long siteUserId;
+    @Column(nullable = false)
+    private long siteUserId;
src/main/java/com/example/solidconnection/community/post/service/PostQueryService.java (1)

63-69: 추가 쿼리로 인한 성능 영향을 고려하세요.

ID 기반 연관관계로 변경되면서 Board와 SiteUser를 별도로 조회하는 추가 쿼리가 발생합니다.

변경 전후 비교:

  1. 변경 전: Post 조회 시 연관 엔티티가 함께 로드
  2. 변경 후: Post 조회 + Board 조회 + SiteUser 조회 (총 3개 쿼리)

자주 호출되는 메서드라면 성능 영향을 모니터링하는 것이 좋겠습니다.

src/main/java/com/example/solidconnection/location/region/domain/InterestedRegion.java (1)

30-39: ID 기반 연관관계로의 전환이 잘 되었습니다

변경사항:

  1. SiteUser 엔티티 참조 → long siteUserId로 변경
  2. Region 엔티티 참조 → String regionCode로 변경
  3. 생성자는 여전히 엔티티를 받아 ID를 추출하는 방식 유지

이러한 접근 방식이 API 호환성을 유지하면서도 내부적으로는 ID 기반으로 작동하게 해서 좋습니다.

siteUserId를 primitive long 대신 Long 래퍼 타입으로 사용하는 것을 고려해보세요. null 체크가 가능해져 더 안전한 코드가 될 수 있습니다.

src/main/java/com/example/solidconnection/university/repository/UnivApplyInfoRepository.java (1)

51-55: 메모리 내 limit 처리 개선 제안

현재 전체 결과를 가져온 후 Java Stream으로 limit를 적용하고 있습니다. 대용량 데이터의 경우 성능 문제가 발생할 수 있습니다.

JPQL에서 직접 limit를 적용하는 것을 고려해보세요:

@Query(value = """
    SELECT DISTINCT uai
    FROM UnivApplyInfo uai
    LEFT JOIN FETCH uai.languageRequirements lr
    LEFT JOIN FETCH uai.university u
    LEFT JOIN FETCH u.country c
    LEFT JOIN FETCH u.region r
    WHERE uai.term = :term
    ORDER BY FUNCTION('RAND')
    LIMIT :limitNum
    """, nativeQuery = true)
List<UnivApplyInfo> findRandomByTerm(@Param("term") String term, @Param("limitNum") int limitNum);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fe7aefc and 805ae3d.

📒 Files selected for processing (59)
  • src/main/java/com/example/solidconnection/application/domain/Application.java (3 hunks)
  • src/main/java/com/example/solidconnection/application/dto/ApplicantsResponse.java (2 hunks)
  • src/main/java/com/example/solidconnection/application/repository/ApplicationRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/application/service/ApplicationQueryService.java (2 hunks)
  • src/main/java/com/example/solidconnection/application/service/ApplicationSubmissionService.java (3 hunks)
  • src/main/java/com/example/solidconnection/community/board/domain/Board.java (0 hunks)
  • src/main/java/com/example/solidconnection/community/board/repository/BoardRepository.java (0 hunks)
  • src/main/java/com/example/solidconnection/community/comment/domain/Comment.java (3 hunks)
  • src/main/java/com/example/solidconnection/community/comment/dto/CommentCreateRequest.java (1 hunks)
  • src/main/java/com/example/solidconnection/community/comment/dto/PostFindCommentResponse.java (2 hunks)
  • src/main/java/com/example/solidconnection/community/comment/service/CommentService.java (4 hunks)
  • src/main/java/com/example/solidconnection/community/post/domain/Post.java (3 hunks)
  • src/main/java/com/example/solidconnection/community/post/domain/PostLike.java (1 hunks)
  • src/main/java/com/example/solidconnection/community/post/dto/PostCreateRequest.java (1 hunks)
  • src/main/java/com/example/solidconnection/community/post/repository/PostLikeRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/community/post/repository/PostRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/community/post/service/PostCommandService.java (3 hunks)
  • src/main/java/com/example/solidconnection/community/post/service/PostLikeService.java (3 hunks)
  • src/main/java/com/example/solidconnection/community/post/service/PostQueryService.java (5 hunks)
  • src/main/java/com/example/solidconnection/location/country/domain/Country.java (1 hunks)
  • src/main/java/com/example/solidconnection/location/country/domain/InterestedCountry.java (2 hunks)
  • src/main/java/com/example/solidconnection/location/country/repository/InterestedCountryRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/location/region/domain/InterestedRegion.java (2 hunks)
  • src/main/java/com/example/solidconnection/location/region/repository/InterestedRegionRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/score/domain/GpaScore.java (1 hunks)
  • src/main/java/com/example/solidconnection/score/domain/LanguageTestScore.java (1 hunks)
  • src/main/java/com/example/solidconnection/score/repository/GpaScoreRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/score/repository/LanguageTestScoreRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/score/repository/custom/GpaScoreFilterRepositoryImpl.java (2 hunks)
  • src/main/java/com/example/solidconnection/score/repository/custom/LanguageTestScoreFilterRepositoryImpl.java (2 hunks)
  • src/main/java/com/example/solidconnection/score/service/ScoreService.java (1 hunks)
  • src/main/java/com/example/solidconnection/siteuser/domain/SiteUser.java (0 hunks)
  • src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java (3 hunks)
  • src/main/java/com/example/solidconnection/university/domain/LikedUnivApplyInfo.java (2 hunks)
  • src/main/java/com/example/solidconnection/university/domain/UnivApplyInfo.java (2 hunks)
  • src/main/java/com/example/solidconnection/university/repository/LikedUnivApplyInfoRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/university/repository/UnivApplyInfoRepository.java (2 hunks)
  • src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepositoryImpl.java (2 hunks)
  • src/main/java/com/example/solidconnection/university/service/GeneralUnivApplyInfoRecommendService.java (2 hunks)
  • src/main/java/com/example/solidconnection/university/service/UnivApplyInfoLikeService.java (3 hunks)
  • src/main/java/com/example/solidconnection/university/service/UnivApplyInfoRecommendService.java (1 hunks)
  • src/main/resources/data.sql (1 hunks)
  • src/main/resources/secret (1 hunks)
  • src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java (1 hunks)
  • src/test/java/com/example/solidconnection/community/board/repository/BoardRepositoryForTest.java (1 hunks)
  • src/test/java/com/example/solidconnection/community/comment/fixture/CommentFixtureBuilder.java (1 hunks)
  • src/test/java/com/example/solidconnection/community/comment/service/CommentServiceTest.java (3 hunks)
  • src/test/java/com/example/solidconnection/community/post/fixture/PostFixtureBuilder.java (1 hunks)
  • src/test/java/com/example/solidconnection/community/post/service/PostLikeServiceTest.java (2 hunks)
  • src/test/java/com/example/solidconnection/community/post/service/PostQueryServiceTest.java (2 hunks)
  • src/test/java/com/example/solidconnection/concurrency/PostViewCountConcurrencyTest.java (1 hunks)
  • src/test/java/com/example/solidconnection/location/country/fixture/CountryFixtureBuilder.java (1 hunks)
  • src/test/java/com/example/solidconnection/score/fixture/GpaScoreFixtureBuilder.java (0 hunks)
  • src/test/java/com/example/solidconnection/score/fixture/LanguageTestScoreFixtureBuilder.java (0 hunks)
  • src/test/java/com/example/solidconnection/siteuser/service/MyPageServiceTest.java (2 hunks)
  • src/test/java/com/example/solidconnection/university/repository/LikedUnivApplyInfoRepositoryTest.java (1 hunks)
  • src/test/java/com/example/solidconnection/university/service/GeneralUnivApplyInfoRecommendServiceTest.java (0 hunks)
  • src/test/java/com/example/solidconnection/university/service/UnivApplyInfoLikeServiceTest.java (3 hunks)
  • src/test/java/com/example/solidconnection/university/service/UnivApplyInfoRecommendServiceTest.java (2 hunks)
💤 Files with no reviewable changes (6)
  • src/test/java/com/example/solidconnection/university/service/GeneralUnivApplyInfoRecommendServiceTest.java
  • src/test/java/com/example/solidconnection/score/fixture/LanguageTestScoreFixtureBuilder.java
  • src/test/java/com/example/solidconnection/score/fixture/GpaScoreFixtureBuilder.java
  • src/main/java/com/example/solidconnection/community/board/repository/BoardRepository.java
  • src/main/java/com/example/solidconnection/siteuser/domain/SiteUser.java
  • src/main/java/com/example/solidconnection/community/board/domain/Board.java
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (77)
src/main/resources/secret (1)

1-1: 서브모듈 포인터 변경, 실제 커밋 존재 여부 점검 필수

  1. 서브모듈 커밋 해시가 be52e6c…84002e8… 로 바뀌었습니다.
    • 해당 커밋이 원격 저장소에 실제로 존재하는지 확인해주세요.
    • CI/CD 파이프라인에서 git submodule update --init --recursive 단계가 실패하지 않는지 살펴보세요.
src/main/resources/data.sql (1)

44-47: 검증 완료: 추가 조치 불필요
다음 사항을 확인했습니다:

  1. 마이그레이션 스크립트 확인
    preparation_stage 컬럼이 V18__rename_preparation_status.sql에서 exchange_status로 성공적으로 변경되었습니다.
  2. 코드베이스 참조 여부
    애플리케이션 코드에서 preparation_stage를 참조하는 부분은 없습니다.
  3. Enum 값 일치 여부
    ExchangeStatus enum에 CONSIDERING이 정의되어 있으며 대소문자가 정확히 일치합니다.
src/test/java/com/example/solidconnection/community/post/service/PostQueryServiceTest.java (1)

96-96: 도메인 모델 리팩토링에 맞춰 테스트 로직을 올바르게 수정했습니다.

Post 엔티티에서 Board 엔티티 참조를 제거하고 boardCode 필드로 변경한 것에 맞춰 테스트 필터링 로직이 정확하게 업데이트되었습니다.

  1. 변경 전: post.getBoard().getCode()
  2. 변경 후: post.getBoardCode()

이러한 변경으로 엔티티 간 직접 참조를 제거하면서도 테스트 로직의 일관성을 유지했습니다.

Also applies to: 118-118

src/test/java/com/example/solidconnection/community/post/fixture/PostFixtureBuilder.java (1)

74-74: 픽스처 빌더가 변경된 도메인 모델에 맞춰 올바르게 수정되었습니다.

Post 엔티티의 setBoardAndSiteUser 메서드 시그니처 변경에 맞춰 테스트 픽스처가 정확하게 업데이트되었습니다.

  1. 변경 전: 엔티티 객체 전달 setBoardAndSiteUser(board, siteUser)
  2. 변경 후: ID 값 전달 setBoardAndSiteUser(board.getCode(), siteUser.getId())

이는 엔티티 간 직접 참조를 제거하고 ID 기반 연관관계로 전환하는 리팩토링 목표와 일치합니다.

src/test/java/com/example/solidconnection/community/comment/service/CommentServiceTest.java (1)

131-131: 댓글 테스트 어설션이 리팩토링된 도메인 모델에 맞춰 일관되게 수정되었습니다.

Comment 엔티티에서 SiteUser 엔티티 참조를 제거하고 siteUserId 필드로 변경한 것에 맞춰 테스트 검증 로직이 정확하게 업데이트되었습니다.

  1. 변경 전: getSiteUser().getId() - 엔티티 참조를 통한 ID 접근
  2. 변경 후: getSiteUserId() - 직접 ID 필드 접근

이러한 변경으로 다음 테스트 케이스들이 올바르게 동작합니다:
- 댓글 생성 테스트
- 대댓글 생성 테스트
- 댓글 수정 테스트

Also applies to: 151-151, 208-208

src/test/java/com/example/solidconnection/application/service/ApplicationSubmissionServiceTest.java (1)

87-87: 애플리케이션 조회 로직이 변경된 레포지토리 인터페이스에 맞춰 올바르게 수정되었습니다.

Application 엔티티의 SiteUser 연관관계가 siteUserId 필드로 변경됨에 따라 레포지토리 메서드 호출이 정확하게 업데이트되었습니다.

  1. 변경 전: findBySiteUserAndTerm(user, term) - 엔티티 객체로 조회
  2. 변경 후: findBySiteUserIdAndTerm(user.getId(), term) - 사용자 ID로 조회

이는 엔티티 간 직접 참조를 제거하고 ID 기반 연관관계로 전환하는 리팩토링 목표와 일치하며, 테스트의 검증 로직은 그대로 유지됩니다.

src/test/java/com/example/solidconnection/concurrency/PostViewCountConcurrencyTest.java (1)

80-80: 동시성 테스트의 게시글 생성 로직이 리팩토링된 도메인 모델에 맞춰 올바르게 수정되었습니다.

Post 엔티티의 setBoardAndSiteUser 메서드 시그니처 변경에 맞춰 동시성 테스트의 게시글 생성 로직이 정확하게 업데이트되었습니다.

  1. 변경 전: 엔티티 객체 전달 setBoardAndSiteUser(board, siteUser)
  2. 변경 후: ID 값 전달 setBoardAndSiteUser(board.getCode(), siteUser.getId())

이러한 변경으로 동시성 테스트가 새로운 도메인 모델 구조와 일치하게 되었으며, 테스트의 핵심 로직인 조회수 동시성 처리는 영향을 받지 않습니다.

src/main/java/com/example/solidconnection/community/comment/dto/CommentCreateRequest.java (1)

27-29: 엔티티 참조에서 ID 기반 참조로의 전환 성공 확인

  1. 적용된 변경사항
    • CommentCreateRequesttoEntity에서 전체 SiteUser 객체 대신 siteUser.getId()를 전달하도록 수정했습니다.
  2. setter 메서드 검증
    • Comment 도메인 클래스에 public void setPostAndSiteUser(Post, long siteUserId) 시그니처가 존재합니다.
    • public void setParentCommentAndPostAndSiteUser(Comment, Post, long siteUserId) 시그니처도 올바르게 정의되어 있습니다.
  3. 테스트 및 호출 위치 확인
    • CommentFixtureBuilder에서 ID 기반 호출이 일관되게 사용됩니다.
    • PostLikeService에서도 동일한 패턴으로 postLike.setPostAndSiteUser(post, siteUser.getId())를 호출합니다.
  4. 최종 결론
    • 리팩토링 목표인 엔티티 직접 참조 제거 및 ID 기반 연관관계 전환이 완벽하게 적용되었습니다.

모든 검증이 완료되었으며 추가 수정은 필요하지 않습니다. 수고하셨습니다.

src/main/java/com/example/solidconnection/application/service/ApplicationQueryService.java (2)

59-59: 사용자 엔티티 참조를 ID 기반으로 성공적으로 변경

다음과 같이 리팩토링이 적절히 적용되었습니다:

  1. 레포지토리 메서드 호출 업데이트: getApplicationBySiteUserIdAndTerm(siteUser.getId(), term) 사용
  2. 메서드명 변경: getApplicationBySiteUserAndTermgetApplicationBySiteUserIdAndTerm

이는 엔티티 직접 참조를 제거하고 ID 기반 쿼리로 전환하는 전체적인 리팩토링 방향과 일치합니다.


123-123: 검증 메서드에서도 ID 기반 접근 방식 일관성 있게 적용

사용자 승인 상태 검증 시에도 동일한 패턴이 적용되어 코드베이스 전체의 일관성을 유지하고 있습니다.

src/main/java/com/example/solidconnection/score/repository/custom/LanguageTestScoreFilterRepositoryImpl.java (1)

73-73: QueryDSL 조인 구문이 새로운 도메인 모델에 맞게 올바르게 업데이트됨

다음과 같이 엔티티 연관관계 제거에 따른 조인 방식 변경이 적절히 처리되었습니다:

  1. 명시적 조인 조건 사용: .join(siteUser).on(languageTestScore.siteUserId.eq(siteUser.id))
  2. 외래키 필드 활용: siteUserId 필드를 사용하여 조인 조건 명시
  3. 일관성 유지: 검색 쿼리와 카운트 쿼리 모두 동일한 방식 적용

이러한 변경은 JPA 엔티티 연관관계 제거 후 QueryDSL에서 필요한 표준적인 수정사항입니다.

Also applies to: 87-87

src/test/java/com/example/solidconnection/community/post/service/PostLikeServiceTest.java (1)

82-82: 테스트 코드가 새로운 레포지토리 메서드 시그니처에 맞게 정확히 업데이트됨

다음과 같이 테스트 검증 로직이 적절히 수정되었습니다:

  1. 레포지토리 메서드 호출 변경: findPostLikeByPostAndSiteUserId(post, user.getId()) 사용
  2. 일관성 있는 패턴 적용: 좋아요 생성 테스트와 취소 테스트 모두 동일한 방식 적용
  3. 테스트 로직 유지: 기존 테스트의 의도와 검증 범위는 그대로 유지

이는 도메인 모델 변경에 따른 자연스러운 테스트 코드 업데이트입니다.

Also applies to: 120-120

src/test/java/com/example/solidconnection/university/repository/LikedUnivApplyInfoRepositoryTest.java (1)

84-85: 테스트 헬퍼 메서드가 ID 기반 필드를 사용하도록 정확히 업데이트됨

다음과 같이 엔티티 빌더 패턴이 새로운 도메인 모델에 맞게 수정되었습니다:

  1. ID 필드 사용: siteUserId(siteUser.getId())univApplyInfoId(univApplyInfo.getId()) 활용
  2. 엔티티 참조 제거: 직접적인 엔티티 참조 대신 ID 값만 저장
  3. 테스트 일관성 유지: 기존 테스트 로직은 그대로 유지하면서 구현 방식만 변경

이러한 변경은 LikedUnivApplyInfo 엔티티의 리팩토링과 완벽히 일치합니다.

src/test/java/com/example/solidconnection/location/country/fixture/CountryFixtureBuilder.java (1)

40-40: 1. 엔티티 참조를 코드 기반 참조로 올바르게 변경했습니다

Region 엔티티 전체를 전달하는 대신 region.getCode()를 전달하도록 수정한 것이 전반적인 리팩토링 목표와 일치합니다. 테스트 픽스처에서의 변경사항이 도메인 모델 변경과 일관성을 유지하고 있어 좋습니다.

src/main/java/com/example/solidconnection/application/dto/ApplicantsResponse.java (1)

8-8: 2. 안전한 null 체크와 함께 ID 기반 비교로 개선했습니다

1. `Objects.equals()` 사용으로 null-safe 비교 구현
2. 엔티티 탐색(`application.getSiteUser().getId()`)에서 직접 ID 접근(`application.getSiteUserId()`)으로 변경
3. 잠재적인 NullPointerException 위험 제거

이러한 변경은 전반적인 리팩토링 목표에 부합하며, 더 안전한 코드로 개선되었습니다.

Also applies to: 28-28

src/main/java/com/example/solidconnection/score/repository/custom/GpaScoreFilterRepositoryImpl.java (1)

73-73: 3. QueryDSL 조인 구문을 ID 기반 연관관계에 맞게 정확히 수정했습니다

1. 암시적 조인(`.join(gpaScore.siteUser, siteUser)`)에서 명시적 조인으로 변경
2. ID 기반 연관관계에 맞는 ON 조건 사용(`.join(siteUser).on(gpaScore.siteUserId.eq(siteUser.id))`)
3. 메인 쿼리와 카운트 쿼리 모두 일관되게 수정

도메인 모델의 변경사항을 QueryDSL 쿼리에 올바르게 반영하여 데이터 접근 로직의 일관성을 유지했습니다.

Also applies to: 87-87

src/test/java/com/example/solidconnection/community/comment/fixture/CommentFixtureBuilder.java (1)

43-43: 4. 테스트 픽스처를 새로운 도메인 모델에 맞게 올바르게 업데이트했습니다

1. `setPostAndSiteUser` 메서드 호출 시 SiteUser 엔티티 대신 `siteUser.getId()` 전달
2. `setParentCommentAndPostAndSiteUser` 메서드 호출도 동일하게 ID 기반으로 변경
3. Comment 도메인의 ID 기반 연관관계 변경사항과 일관성 유지

테스트 코드가 새로운 도메인 모델의 변경사항을 정확히 반영하고 있어 좋습니다.

Also applies to: 49-50

src/main/java/com/example/solidconnection/location/region/repository/InterestedRegionRepository.java (1)

11-11: 5. 리포지토리 메서드 시그니처를 ID 기반으로 간소화했습니다

1. 메서드명을 `findAllBySiteUser`에서 `findAllBySiteUserId`로 변경
2. 파라미터 타입을 `SiteUser` 엔티티에서 `long siteUserId`로 변경
3. Spring Data JPA 명명 규칙을 올바르게 따름

도메인 모델의 변경사항을 리포지토리 인터페이스에 정확히 반영하여 메서드 시그니처가 더 간결하고 명확해졌습니다.

src/test/java/com/example/solidconnection/siteuser/service/MyPageServiceTest.java (2)

196-198: 엔티티 생성 방식이 ID 기반으로 개선되었습니다.

  1. LikedUnivApplyInfo 생성 시 엔티티 참조 대신 ID 값을 직접 사용하도록 변경
  2. .getId() 메서드 호출로 명확한 ID 추출
  3. 새로운 생성자 시그니처와 일치하는 올바른 구현

이 변경은 전반적인 리팩토링 패턴과 일관성 있게 적용되었습니다.


203-203: 리포지토리 메서드 호출이 개선되었습니다.

  1. 기존 countBySiteUser_Id 에서 countBySiteUserId 로 변경
  2. 중첩된 프로퍼티 접근 방식에서 직접 ID 기반 접근으로 단순화
  3. 메서드 시그니처 변경과 일치하는 정확한 호출
src/main/java/com/example/solidconnection/location/country/repository/InterestedCountryRepository.java (1)

10-10: 리포지토리 메서드 시그니처가 ID 기반으로 개선되었습니다.

  1. SiteUser 엔티티 매개변수를 long siteUserId 로 변경
  2. 메서드명도 findAllBySiteUserId 로 명확하게 수정
  3. 불필요한 엔티티 참조 제거로 성능 및 단순성 향상

전반적인 리팩토링 패턴과 완벽하게 일치하는 변경입니다.

src/main/java/com/example/solidconnection/university/service/UnivApplyInfoLikeService.java (4)

41-41: 리포지토리 메서드 호출이 ID 기반으로 개선되었습니다.

  1. findBySiteUserIdAndUnivApplyInfoId 메서드 사용으로 변경
  2. siteUser.getId()univApplyInfo.getId() 를 직접 전달
  3. 엔티티 참조 대신 ID 기반 조회로 성능 향상

47-48: 엔티티 생성 방식이 ID 기반으로 개선되었습니다.

  1. LikedUnivApplyInfo 빌더에서 엔티티 참조 대신 ID 필드 사용
  2. .univApplyInfoId().siteUserId() 메서드로 명확한 ID 설정
  3. 새로운 엔티티 구조와 일치하는 올바른 구현

61-61: 좋아요 취소 로직에서 ID 기반 조회로 개선되었습니다.

  1. 동일한 패턴으로 findBySiteUserIdAndUnivApplyInfoId 메서드 사용
  2. 일관된 ID 기반 접근 방식 적용
  3. 기존 비즈니스 로직 유지

76-76: 좋아요 상태 확인 로직이 ID 기반으로 개선되었습니다.

  1. isLike 상태 확인에서도 동일한 ID 기반 접근 사용
  2. 서비스 메서드 전반에 걸쳐 일관된 패턴 적용
  3. 기능적 동작은 동일하게 유지
src/main/java/com/example/solidconnection/community/post/dto/PostCreateRequest.java (1)

39-39: 게시글 생성 시 엔티티 연관관계 설정이 ID 기반으로 개선되었습니다.

  1. board.getCode()siteUser.getId() 를 직접 전달
  2. 엔티티 참조 대신 식별자 기반 연관관계 설정
  3. Post 엔티티의 새로운 구조와 완벽하게 일치

전반적인 리팩토링 목표에 부합하는 올바른 변경입니다.

src/main/java/com/example/solidconnection/community/post/repository/PostRepository.java (2)

18-18: 게시판 코드 기반 게시글 조회 메서드가 추가되었습니다.

  1. findByBoardCode(String boardCode) 메서드 신규 추가
  2. 엔티티 참조 대신 코드 기반 조회 방식으로 개선
  3. 서비스 레이어에서 게시판별 게시글 조회 시 활용 가능

리팩토링 목표에 부합하는 유용한 메서드 추가입니다.


19-19: EntityGraph 설정이 최적화되었습니다.

  1. "board""siteUser" 를 fetch graph에서 제거
  2. 이제 "postImageList" 만 즉시 로딩으로 설정
  3. 엔티티 참조 제거에 따른 합리적인 최적화

불필요한 연관관계 로딩을 제거하여 성능이 향상될 것으로 예상됩니다.

src/main/java/com/example/solidconnection/university/service/UnivApplyInfoRecommendService.java (1)

40-40: 엔티티 연관관계 리팩토링 완료!

SiteUser 엔티티 대신 siteUser.getId()를 전달하도록 수정한 것이 올바릅니다. 이는 전체 코드베이스에서 진행하고 있는 엔티티 연관관계를 ID 기반으로 변경하는 리팩토링 패턴과 일치합니다.

src/main/java/com/example/solidconnection/community/post/service/PostCommandService.java (3)

28-28: null 안전 비교를 위한 import 추가

Objects 클래스를 import하여 validateOwnership 메서드에서 null 안전 비교를 수행하도록 개선했습니다.


109-109: ID 기반 소유권 검증으로 개선

엔티티 비교 대신 ID 비교를 통해 소유권을 검증하도록 변경했습니다. 이는 다음과 같은 장점을 제공합니다:

  1. null 안전성: Objects.equals() 사용으로 null 포인터 예외 방지
  2. 성능 향상: 엔티티 전체 비교가 아닌 ID 비교로 성능 개선
  3. 일관성: 전체 코드베이스의 ID 기반 연관관계 패턴과 일치

55-55: 1. 엔티티 생성 방식 확인 완료
PostCreateRequest.toEntity 구현부에서 siteUser.getId()를 호출해 식별자 기반으로 Post를 생성하고 있습니다.
2. 추가 수정 불필요
PostCommandService.java:55의 호출부도 그대로 유지해도 무방합니다.

src/test/java/com/example/solidconnection/university/service/UnivApplyInfoLikeServiceTest.java (3)

64-66: 테스트 코드 ID 기반 조회로 업데이트

Repository 메서드 호출을 엔티티 객체 대신 ID를 사용하도록 변경했습니다. 이는 LikedUnivApplyInfoRepository의 메서드 시그니처 변경과 일치합니다.


96-98: 좋아요 취소 검증 로직 업데이트

좋아요 취소 후 검증 로직에서도 ID 기반 조회를 사용하도록 일관성 있게 변경했습니다.


156-157: 테스트 데이터 생성 방식 개선

LikedUnivApplyInfo 엔티티 생성 시 엔티티 객체 대신 ID를 사용하도록 변경했습니다. 이는 도메인 모델의 변경사항과 일치합니다.

src/test/java/com/example/solidconnection/university/service/UnivApplyInfoRecommendServiceTest.java (2)

143-145: 테스트 검증 방식 개선

캐시된 상태에 의존하지 않고 반환된 데이터의 속성을 검증하도록 변경했습니다:

  1. 한글명 존재 여부: koreanName() != null
  2. 유효한 ID: id() > 0
  3. 올바른 학기: term().equals("2024-1")

이는 GeneralUnivApplyInfoRecommendService의 캐시 제거 및 동적 조회 방식 변경과 일치합니다.


155-156: 일반 추천 테스트 검증 로직 일관성 유지

일반 추천 조회 테스트에서도 속성 기반 검증을 사용하여 일관성을 유지했습니다. 캐시된 내용에 의존하지 않는 robust한 테스트로 개선되었습니다.

src/main/java/com/example/solidconnection/community/post/domain/PostLike.java (1)

28-28: JPA 연관관계를 primitive 필드로 변경

SiteUser 엔티티 연관관계를 long siteUserId 필드로 대체했습니다. 이는 엔티티 간 결합도를 낮추고 데이터 접근을 단순화하는 좋은 리팩토링입니다.

src/main/java/com/example/solidconnection/community/comment/dto/PostFindCommentResponse.java (3)

4-4: 임포트 추가가 올바릅니다.

SiteUser 임포트 추가가 메서드 시그니처 변경과 일치합니다.


27-27: DTO 생성 로직이 올바르게 업데이트되었습니다.

siteUser 파라미터를 PostFindSiteUserResponse.from에 전달하는 변경이 적절합니다.


19-19: 변경된 메서드 시그니처 및 호출부 검증 완료.
엔티티 분리 목적에 따라 SiteUser 파라미터를 명시적으로 받도록 메서드 시그니처를 변경한 것은 적절합니다.
모든 호출부가 새로운 시그니처에 맞춰 정상적으로 업데이트된 것을 확인했습니다.
추가 수정은 필요하지 않습니다.

워크스루:

  1. 메서드 시그니처 변경
    • PostFindCommentResponse.from(Boolean isOwner, Comment comment, SiteUser siteUser)로 변경됨
  2. 호출부 업데이트 검증
    • CommentService.java.map(comment -> PostFindCommentResponse.from(isOwner(comment, siteUser), comment, siteUser)) 호출이 정상적으로 반영됨
src/main/java/com/example/solidconnection/application/service/ApplicationSubmissionService.java (3)

53-53: 레포지토리 메서드 호출이 ID 기반으로 올바르게 변경되었습니다.

siteUser.getId()를 사용하여 엔티티 직접 참조를 피하는 것이 리팩토링 목적에 부합합니다.


81-81: GPA 점수 조회 로직이 일관되게 업데이트되었습니다.

ID 기반 조회 방식으로 변경하여 엔티티 결합도를 줄인 것이 좋습니다.


91-91: 언어 시험 점수 조회 로직이 일관되게 업데이트되었습니다.

ID 기반 조회 방식으로 변경하여 전체 리팩토링 패턴과 일치합니다.

src/main/java/com/example/solidconnection/university/service/GeneralUnivApplyInfoRecommendService.java (2)

8-8: 트랜잭션 임포트 추가가 적절합니다.

@transactional 어노테이션 사용을 위한 임포트 추가가 올바릅니다.


26-29: 온디맨드 조회 방식 적용이 적절합니다.

1. `@Transactional(readOnly = true)`로 읽기 전용 트랜잭션을 최적화했습니다.  
2. 캐싱 대신 온디맨드 조회로 전환해 메모리 사용량을 절감했습니다.  
3. 메서드명 `getGeneralRecommends`가 기능을 명확히 표현합니다.  

검증 결과, findRandomByTerm 메서드가 의도대로 구현되어 있어 추가 수정이 필요 없습니다.

src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java (3)

11-11: 임포트 변경이 비즈니스 로직 단순화에 기여합니다.

LikedUnivApplyInfo에서 UnivApplyInfo로 직접 변경하여 불필요한 엔티티 레이어를 제거한 것이 좋습니다.


42-42: 카운트 조회 로직이 ID 기반으로 올바르게 변경되었습니다.

siteUser.getId()를 사용하여 엔티티 직접 참조를 피하는 것이 리팩토링 패턴과 일치합니다.


98-102: ✅ 관심 대학교 조회 로직 개선 및 승인

  1. 중간 DTO 없이 UnivApplyInfo 직접 반환
  2. 스트림 처리 로직 단순화
  3. 메서드명으로 반환 타입 명확화

LikedUnivApplyInfoRepository 인터페이스(라인 26)에 findUnivApplyInfosBySiteUserId 메서드 시그니처가 정상적으로 정의되어 있음을 확인했습니다.
Spring Data JPA가 해당 메서드를 자동 구현하므로 추가 구현 변경은 필요 없습니다.
모든 변경사항이 적절히 반영되었으니 머지 진행 부탁드립니다.

src/main/java/com/example/solidconnection/community/comment/service/CommentService.java (6)

21-21: Objects 임포트 추가가 null 안전성 향상에 기여합니다.

Objects.equals 사용을 위한 임포트 추가가 적절합니다.


39-40: 사용자 존재 확인 로직이 안전성을 강화합니다.

데이터베이스에서 사용자 존재를 확인하여 예외 상황을 사전에 방지하는 것이 좋습니다.


43-43: DTO 생성 로직이 새로운 시그니처에 맞게 업데이트되었습니다.

PostFindCommentResponse.from 메서드에 siteUser 파라미터를 명시적으로 전달하는 것이 올바릅니다.


48-48: null 안전성이 향상되었습니다.

Objects.equals 사용으로 null 포인터 예외를 방지하는 것이 좋은 개선사항입니다.


60-60: 엔티티 생성 로직이 단순화되었습니다.

불필요한 엔티티 조회를 제거하고 전달받은 siteUser를 직접 사용하는 것이 효율적입니다.


121-121: 소유권 검증 로직의 null 안전성이 향상되었습니다.

Objects.equals 사용으로 null 포인터 예외를 방지하여 안전한 비교를 수행합니다.

src/main/java/com/example/solidconnection/location/country/domain/Country.java (1)

27-31: Country 생성자 호출 검증 완료
이번 검증에서 new Country(...) 호출 위치를 모두 확인했습니다. 프로덕션 코드에서는 더 이상 호출되지 않고, 테스트 픽스처에서만 사용되고 있음을 발견했습니다. 모든 호출이 새로운 생성자 시그니처(code, koreanName, regionCode)를 준수하고 있어 추가 조치는 필요 없습니다.

  1. 테스트 픽스처 검토
    • 경로: src/test/java/com/example/solidconnection/location/country/fixture/CountryFixtureBuilder.java
    • 사용 예시: new Country(code, koreanName, region.getCode())
  2. 프로덕션 코드 호출 없음
  3. 변경된 생성자에 맞게 정상 동작 확인

이대로 승인합니다.

src/main/java/com/example/solidconnection/score/service/ScoreService.java (2)

36-42: SiteUser 유효성 검증 필요

이제 전달받은 SiteUser 객체를 직접 사용하므로, 해당 사용자가 실제로 존재하는지 검증이 없습니다. 잘못된 ID를 가진 SiteUser가 전달될 경우 문제가 발생할 수 있습니다.

다음과 같은 검증 로직 추가를 고려해보세요:

 @Transactional
 public Long submitGpaScore(SiteUser siteUser, GpaScoreRequest gpaScoreRequest, MultipartFile file) {
+    if (siteUser == null || siteUser.getId() == null) {
+        throw new IllegalArgumentException("유효하지 않은 사용자입니다");
+    }
     UploadedFileUrlResponse uploadedFile = s3Service.uploadFile(file, ImgType.GPA);

55-63: Repository 메서드 변경사항 적절함

findBySiteUserId() 메서드를 사용하여 ID 기반 조회로 변경한 것은 좋습니다. 성능상 이점이 있고 코드가 더 명확해졌습니다.

src/main/java/com/example/solidconnection/application/domain/Application.java (1)

76-77: siteUserId 필드 타입 선택 확인

siteUserId를 primitive long 타입으로 선언했는데, 이는 null을 허용하지 않습니다. 만약 선택적 관계가 필요하다면 Long 타입을 고려해보세요.

src/main/java/com/example/solidconnection/community/post/repository/PostLikeRepository.java (1)

14-19: Repository 메서드 시그니처 변경 적절함

SiteUser 엔티티 대신 long siteUserId를 사용하도록 변경한 것은 좋은 선택입니다. 쿼리 성능이 향상되고 불필요한 조인을 피할 수 있습니다.

src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepositoryImpl.java (1)

50-55: 쿼리 단순화 개선사항 좋습니다

QRegion 조인을 제거하고 country.regionCode를 직접 사용하도록 변경한 것은 훌륭한 개선입니다. 쿼리 성능이 향상될 것으로 예상됩니다.

src/main/java/com/example/solidconnection/score/repository/GpaScoreRepository.java (1)

12-16: 리포지토리 메서드 변경이 잘 구현되었습니다!

엔티티 참조를 ID 기반으로 변경한 것이 일관되게 적용되었고, 메서드 네이밍도 명확합니다. 특히 findBySiteUserId 메서드 추가로 여러 GPA 점수를 조회할 수 있게 된 점이 좋습니다.

src/main/java/com/example/solidconnection/community/post/service/PostQueryService.java (2)

90-90: ID 비교 로직이 안전하게 구현되었습니다!

Objects.equals를 사용하여 null 안전하게 ID를 비교하는 것이 좋은 접근입니다.


51-52: 중복 호출 지적은 부적절합니다.

  1. 검증과 조회의 역할 분리
    boardRepository.getByCode(boardCode)는 Board 존재 여부를 검증하고 없으면 예외를 던집니다.
    postRepository.findByBoardCode(boardCode)는 해당 Board의 Post 리스트를 조회합니다.
  2. 중복 아님
    두 메서드는 완전히 다른 책임을 수행하므로 중복 호출이 아닙니다.

이 리뷰 코멘트는 잘못된 지적이므로 무시해 주세요.

Likely an incorrect or invalid review comment.

src/main/java/com/example/solidconnection/university/domain/UnivApplyInfo.java (2)

80-80: CASCADE 설정의 영향을 신중히 고려하세요.

CascadeType.ALLorphanRemoval = true 설정은 매우 강력한 옵션입니다:

  1. CascadeType.ALL: UnivApplyInfo의 모든 영속성 작업(persist, remove, refresh, merge, detach)이 LanguageRequirement로 전파됩니다
  2. orphanRemoval = true: 컬렉션에서 제거된 LanguageRequirement는 데이터베이스에서도 삭제됩니다

이는 의도한 동작인지 확인이 필요합니다. 특히 LanguageRequirement가 다른 곳에서도 참조되지 않는지 검증하세요.


83-83: LazyInitializationException 우려 해소: 모든 getUniversity() 호출이 트랜잭션 내에서 처리됩니다.

  1. 트랜잭션 범위 확인
     - UnivApplyInfoQueryServicegetUnivApplyInfoDetail 및 Preview 응답 메소드 모두 @Transactional(readOnly = true)로 감싸져 있어, univApplyInfo.getUniversity()가 안전하게 호출됩니다.

  2. ApplicationQueryService 검토
     - getApplicants 메소드들(행 41, 57, 121)에 @Transactional(readOnly = true)가 적용되어 있으며, 이 안에서 ApplicantsResponse.of가 실행되어 Lazy 로딩 예외가 발생하지 않습니다.

따라서 추가 조치 없이 변경을 그대로 승인합니다.

src/main/java/com/example/solidconnection/application/repository/ApplicationRepository.java (1)

19-29: 부정확한 검토 코멘트: Application 엔티티에 siteUser 연관 매핑이 없습니다.

  1. Application 엔티티 구조 확인
     - Application 클래스는 siteUserId(long) 필드만 정의되어 있고, SiteUser 객체를 참조하는 연관 관계가 존재하지 않습니다.
  2. JOIN FETCH 사용 이력 없음
     - 원본 쿼리에도 a.siteUser와의 JOIN FETCH 구문이 없었으므로, 해당 구문 제거에 따른 변경 사항이 없습니다.
  3. N+1 쿼리 우려 불필요
     - 연관 매핑이 없으므로 SiteUser 정보를 지연로딩하거나 추가 조회할 일이 없고, N+1 문제가 발생하지 않습니다.

따라서 이 코멘트는 무시해 주시면 됩니다.

Likely an incorrect or invalid review comment.

src/main/java/com/example/solidconnection/community/post/service/PostLikeService.java (1)

28-55: 서비스 레이어 리팩토링 잘 되었습니다!

SiteUser 엔티티를 파라미터로 받지만 ID만 사용하도록 변경된 점이 적절합니다. 이는 서비스 인터페이스의 하위 호환성을 유지하면서도 내부 구현을 개선한 좋은 접근입니다.

src/main/java/com/example/solidconnection/score/domain/LanguageTestScore.java (1)

42-46: 생성자 로직이 깔끔합니다!

생성자에서 SiteUser 객체를 받아 ID만 추출하여 저장하는 방식이 적절합니다. 이는 호출하는 코드의 변경을 최소화하면서도 내부 구현을 개선한 좋은 패턴입니다.

src/main/java/com/example/solidconnection/community/comment/domain/Comment.java (2)

48-49: 엔티티 참조에서 ID 기반으로의 변경 승인

SiteUser 엔티티 직접 참조를 siteUserId로 변경한 것이 적절합니다. 이는 도메인 간 결합도를 낮추고 성능을 향상시킬 수 있습니다.


62-77: 메서드 시그니처 변경이 적절합니다

두 메서드 모두 SiteUser 대신 long siteUserId를 받도록 올바르게 수정되었습니다. 기존 로직은 그대로 유지되면서 ID 기반 참조로 변경되었네요.

src/main/java/com/example/solidconnection/community/post/domain/Post.java (2)

48-53: 엔티티 참조를 ID로 변경한 것이 적절합니다

변경사항:

  1. Board 엔티티 → String boardCode
  2. SiteUser 엔티티 → long siteUserId

도메인 간 결합도를 낮추는 좋은 리팩토링입니다.


63-65: BatchSize 추가가 좋습니다

postLikeList@BatchSize(size = 5) 추가로 N+1 문제를 방지할 수 있게 되었네요. 성능 최적화에 도움이 될 것입니다.

src/main/java/com/example/solidconnection/university/repository/UnivApplyInfoRepository.java (2)

19-38: ID 기반 서브쿼리로의 전환이 잘 되었습니다

변경사항:

  1. SiteUser 엔티티 파라미터 → Long siteUserId 파라미터
  2. 서브쿼리를 통한 InterestedCountryInterestedRegion 조회
  3. DISTINCTLEFT JOIN FETCH로 중복 제거 및 eager loading 처리

쿼리가 복잡해 보이지만 ID 기반 조회로 성능이 향상될 것으로 보입니다.


40-55: MySQL 환경 확인 완료: RAND() 함수 사용은 호환성 문제 없음

1. 검증  
    - application.yml에서 `database: mysql` 설정을 확인했습니다.  
2. 결론  
    - MySQL 환경에서는 `FUNCTION('RAND')` 호출이 올바르게 동작합니다.  
3. 조치  
    - 추가 수정 없이 현재 구현을 유지하시면 됩니다.  

감사합니다.

src/main/java/com/example/solidconnection/university/repository/LikedUnivApplyInfoRepository.java (2)

14-18: 메서드명 변경이 적절합니다

변경사항:

  1. findAllBySiteUser_IdfindAllBySiteUserId
  2. countBySiteUser_IdcountBySiteUserId
  3. findBySiteUserAndUnivApplyInfofindBySiteUserIdAndUnivApplyInfoId

네이밍이 더 직관적이고 명확해졌습니다.


20-26: JPQL 쿼리 추가가 좋습니다

LikedUnivApplyInfo를 통해 UnivApplyInfo를 조회하는 명시적인 쿼리가 추가되어 의도가 명확해졌습니다. JOIN을 사용한 접근이 효율적입니다.

// when
MyPageResponse response = myPageService.getMyPageInfo(user);


Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

테스트 검증 로직이 제거되었습니다.

  1. 기존 response.likedPostCount() 검증 로직이 삭제되었는데, 이는 테스트 커버리지 감소를 의미합니다.
  2. 마이페이지 응답에서 좋아요한 게시글 수 검증이 중요한 기능이므로, 해당 검증 로직을 다시 추가하는 것을 권장합니다.
🤖 Prompt for AI Agents
In
src/test/java/com/example/solidconnection/siteuser/service/MyPageServiceTest.java
at line 83, the test verification for response.likedPostCount() was removed,
reducing test coverage. Re-add the assertion that verifies the likedPostCount
value in the MyPage response to ensure this important functionality is properly
tested.

.selectFrom(univApplyInfo)
.join(univApplyInfo.university, university)
.join(university.country, country)
.join(university.region, region)
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

사용하지 않는 region 조인 제거 필요

85번 줄에서 region과 조인하고 있지만 실제로 사용되지 않습니다. 제거하는 것이 좋겠습니다.

다음과 같이 수정하세요:

         List<UnivApplyInfo> filteredUnivApplyInfo = queryFactory
                 .selectFrom(univApplyInfo)
                 .join(univApplyInfo.university, university)
                 .join(university.country, country)
-                .join(university.region, region)
                 .where(regionCodeEq(country, regionCode)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.join(university.region, region)
List<UnivApplyInfo> filteredUnivApplyInfo = queryFactory
.selectFrom(univApplyInfo)
.join(univApplyInfo.university, university)
.join(university.country, country)
.where(regionCodeEq(country, regionCode)
// …rest of the query…
🤖 Prompt for AI Agents
In
src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepositoryImpl.java
at line 85, the join with `region` is not used anywhere in the query. Remove the
`.join(university.region, region)` line to clean up the code and avoid
unnecessary joins.

Comment on lines 42 to 47
public GpaScore(Gpa gpa, SiteUser siteUser) {
this.gpa = gpa;
this.siteUser = siteUser;
this.siteUserId = siteUser.getId();
this.verifyStatus = VerifyStatus.PENDING;
this.rejectedReason = null;
}
Copy link

@coderabbitai coderabbitai bot Jul 3, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

생성자에서 null 안전성 검증을 추가하세요.

siteUser.getId()를 호출할 때 siteUser가 null이거나 ID가 아직 할당되지 않은 경우를 처리해야 합니다. 특히 새로운 엔티티의 경우 ID가 null일 수 있습니다.

 public GpaScore(Gpa gpa, SiteUser siteUser) {
+    if (siteUser == null || siteUser.getId() == null) {
+        throw new IllegalArgumentException("SiteUser and its ID must not be null");
+    }
     this.gpa = gpa;
     this.siteUserId = siteUser.getId();
     this.verifyStatus = VerifyStatus.PENDING;
     this.rejectedReason = null;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public GpaScore(Gpa gpa, SiteUser siteUser) {
this.gpa = gpa;
this.siteUser = siteUser;
this.siteUserId = siteUser.getId();
this.verifyStatus = VerifyStatus.PENDING;
this.rejectedReason = null;
}
public GpaScore(Gpa gpa, SiteUser siteUser) {
if (siteUser == null || siteUser.getId() == null) {
throw new IllegalArgumentException("SiteUser and its ID must not be null");
}
this.gpa = gpa;
this.siteUserId = siteUser.getId();
this.verifyStatus = VerifyStatus.PENDING;
this.rejectedReason = null;
}
🤖 Prompt for AI Agents
In src/main/java/com/example/solidconnection/score/domain/GpaScore.java around
lines 42 to 47, the constructor does not check for null safety when accessing
siteUser.getId(). To fix this, add null checks to ensure siteUser is not null
and its ID is not null before assigning to siteUserId. If either is null, handle
appropriately, such as throwing an IllegalArgumentException or setting a default
value, to prevent NullPointerException and ensure safe object creation.

Copy link
Member

Choose a reason for hiding this comment

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

얘도 .. 굳이 ?

Copy link

Choose a reason for hiding this comment

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

@whqtker, 네, 이해했습니다! 👍

실제로 엔티티가 생성되는 맥락에서는 SiteUser가 이미 검증된 상태로 넘어올 가능성이 높고, 추가적인 검증 코드가 과도할 수 있겠네요. 도메인 로직의 복잡성을 고려하면 굳이 필요하지 않을 수 있습니다.

    \   /
     ⌒⌒
    (  ˶ᵔ ᵕ ᵔ˶ )
   ⌒⌒⌒⌒⌒⌒⌒⌒
  (   이해했어요~   )
   ⌒⌒⌒⌒⌒⌒⌒⌒

Comment on lines 36 to 39
public InterestedCountry(SiteUser siteUser, Country country) {
this.siteUser = siteUser;
this.country = country;
this.siteUserId = siteUser.getId();
this.countryCode = country.getCode();
}
Copy link

@coderabbitai coderabbitai bot Jul 3, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

생성자에서 유효성 검증을 추가하세요.

엔티티에서 ID와 코드를 추출할 때 null 체크가 필요합니다:

 public InterestedCountry(SiteUser siteUser, Country country) {
+    if (siteUser == null || siteUser.getId() == null) {
+        throw new IllegalArgumentException("SiteUser and its ID must not be null");
+    }
+    if (country == null || country.getCode() == null) {
+        throw new IllegalArgumentException("Country and its code must not be null");
+    }
     this.siteUserId = siteUser.getId();
     this.countryCode = country.getCode();
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public InterestedCountry(SiteUser siteUser, Country country) {
this.siteUser = siteUser;
this.country = country;
this.siteUserId = siteUser.getId();
this.countryCode = country.getCode();
}
public InterestedCountry(SiteUser siteUser, Country country) {
if (siteUser == null || siteUser.getId() == null) {
throw new IllegalArgumentException("SiteUser and its ID must not be null");
}
if (country == null || country.getCode() == null) {
throw new IllegalArgumentException("Country and its code must not be null");
}
this.siteUserId = siteUser.getId();
this.countryCode = country.getCode();
}
🤖 Prompt for AI Agents
In
src/main/java/com/example/solidconnection/location/country/domain/InterestedCountry.java
at lines 36 to 39, the constructor extracts IDs and codes without null checks.
Add validation to ensure siteUser and country are not null, and their getId()
and getCode() methods do not return null. If any are null, throw an appropriate
exception to prevent invalid state in the entity.

Copy link
Member

Choose a reason for hiding this comment

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

얘도 굳이 ..?

Copy link

Choose a reason for hiding this comment

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

@whqtker, 네, 맞습니다. 이미 JPA 엔티티로 관리되는 객체들이고, 실제 서비스 로직에서 이런 null 케이스가 발생할 가능성이 낮다면 굳이 추가할 필요 없겠네요. 현재 코드 구조상 충분히 안전하다고 판단되시면 그대로 두시면 됩니다.

Comment on lines 30 to 34
@Column(name="site_user_id")
private long siteUserId;

@ManyToOne
private Country country;
@Column(name="country_code")
private String countryCode;
Copy link

@coderabbitai coderabbitai bot Jul 3, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

필드 타입과 제약 조건을 재검토하세요.

현재 구현의 몇 가지 개선점:

  1. siteUserId: primitive long 타입이므로 null이 될 수 없습니다. 이는 좋지만 nullable = false 제약을 명시하면 더 명확합니다
  2. countryCode: String이므로 null이 가능합니다. nullable = false와 길이 제한을 추가하는 것이 좋겠습니다
-    @Column(name="site_user_id")
+    @Column(name="site_user_id", nullable = false)
     private long siteUserId;

-    @Column(name="country_code")
+    @Column(name="country_code", nullable = false, length = 10)
     private String countryCode;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Column(name="site_user_id")
private long siteUserId;
@ManyToOne
private Country country;
@Column(name="country_code")
private String countryCode;
@Column(name="site_user_id", nullable = false)
private long siteUserId;
@Column(name="country_code", nullable = false, length = 10)
private String countryCode;
🤖 Prompt for AI Agents
In
src/main/java/com/example/solidconnection/location/country/domain/InterestedCountry.java
around lines 30 to 34, the fields siteUserId and countryCode lack explicit
nullability constraints. Add nullable = false to the @Column annotation for
siteUserId to clarify it cannot be null. For countryCode, add nullable = false
and specify a length attribute to enforce a maximum string length, ensuring
better data integrity.

Copy link
Member

Choose a reason for hiding this comment

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

이건 굳이 해야 되나 싶긴 한데 좀 생각해 봐야겠네요

Copy link

Choose a reason for hiding this comment

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

@whqtker 맞습니다, 충분히 고민해볼 만한 사항이네요.

현재 코드도 충분히 동작하고 있고, 특히 siteUserId는 primitive long이라 이미 null이 될 수 없으니까요. countryCode의 경우에는 비즈니스 로직에서 null 체크를 하고 있다면 굳이 DB 레벨에서 제약을 걸 필요가 없을 수도 있습니다.

이런 명시적 제약은 주로 새로운 팀원이나 향후 유지보수를 위한 문서화 역할이 크니까, 프로젝트 상황에 맞게 결정하시면 될 것 같습니다.

   /|   /|  
  ( :v:  )
   |(_)|

Comment on lines 34 to 38
@Column(name="university_info_for_apply_id")
private long univApplyInfoId;

@ManyToOne
private SiteUser siteUser;
@Column(name="site_user_id")
private long siteUserId;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Primitive 타입 대신 Wrapper 클래스 사용 권장

현재 univApplyInfoIdsiteUserId 필드가 primitive long 타입으로 선언되어 있습니다. 이는 다음과 같은 문제를 야기할 수 있습니다:

  • null 값을 표현할 수 없어 "설정되지 않음" 상태를 구분하기 어려움
  • 기본값이 0으로 설정되어 실제 ID 0과 구분 불가
  • 데이터 무결성 문제 발생 가능
-    @Column(name="university_info_for_apply_id")
-    private long univApplyInfoId;
+    @Column(name="university_info_for_apply_id")
+    private Long univApplyInfoId;

-    @Column(name="site_user_id")
-    private long siteUserId;
+    @Column(name="site_user_id")
+    private Long siteUserId;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Column(name="university_info_for_apply_id")
private long univApplyInfoId;
@ManyToOne
private SiteUser siteUser;
@Column(name="site_user_id")
private long siteUserId;
@Column(name="university_info_for_apply_id")
private Long univApplyInfoId;
@Column(name="site_user_id")
private Long siteUserId;
🤖 Prompt for AI Agents
In
src/main/java/com/example/solidconnection/university/domain/LikedUnivApplyInfo.java
around lines 34 to 38, change the fields univApplyInfoId and siteUserId from
primitive long to their wrapper class Long. This allows these fields to hold
null values, distinguishing unset states from actual zero values and improving
data integrity. Update the field declarations and any related code to use Long
instead of long.


@ManyToOne
private SiteUser siteUser;
private long siteUserId;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Primitive 타입 대신 Wrapper 클래스 사용 권장

siteUserId 필드가 primitive long 타입으로 선언되어 있습니다. LikedUnivApplyInfo 엔티티와 동일한 문제가 발생할 수 있으므로, Long wrapper 타입 사용을 권장합니다.

-    private long siteUserId;
+    private Long siteUserId;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private long siteUserId;
private Long siteUserId;
🤖 Prompt for AI Agents
In src/main/java/com/example/solidconnection/score/domain/LanguageTestScore.java
at line 40, change the field type of siteUserId from the primitive long to the
wrapper class Long to avoid issues similar to those in LikedUnivApplyInfo entity
and to allow nullability and better ORM compatibility.

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.

고생하셨습니다 ! 코멘트 남겼습니다.

AND a.isDelete = false
""")
Optional<Application> findBySiteUserAndTerm(@Param("siteUser") SiteUser siteUser, @Param("term") String term);
Optional<Application> findBySiteUserIdAndTerm(@Param("siteUserId") Long siteUserId, @Param("term") String term);
Copy link
Member

Choose a reason for hiding this comment

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

Long -> long 이 좋아 보입니다 !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이건 Community 도메인이 아니라 #363 에서 수정하겠습니다!


default Application getApplicationBySiteUserAndTerm(SiteUser siteUser, String term) {
return findBySiteUserAndTerm(siteUser, term)
default Application getApplicationBySiteUserIdAndTerm(Long siteUserId, String term) {
Copy link
Member

Choose a reason for hiding this comment

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

Long -> long 이 좋아 보입니다 !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이 부분도 Community 도메인이 아니라 #363 에서 수정하겠습니다!

Comment on lines 30 to 34
@Column(name="site_user_id")
private long siteUserId;

@ManyToOne
private Country country;
@Column(name="country_code")
private String countryCode;
Copy link
Member

Choose a reason for hiding this comment

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

이건 굳이 해야 되나 싶긴 한데 좀 생각해 봐야겠네요

Comment on lines 36 to 39
public InterestedCountry(SiteUser siteUser, Country country) {
this.siteUser = siteUser;
this.country = country;
this.siteUserId = siteUser.getId();
this.countryCode = country.getCode();
}
Copy link
Member

Choose a reason for hiding this comment

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

얘도 굳이 ..?

Comment on lines 42 to 47
public GpaScore(Gpa gpa, SiteUser siteUser) {
this.gpa = gpa;
this.siteUser = siteUser;
this.siteUserId = siteUser.getId();
this.verifyStatus = VerifyStatus.PENDING;
this.rejectedReason = null;
}
Copy link
Member

Choose a reason for hiding this comment

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

얘도 .. 굳이 ?

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.

고생하셨습니다~


if (parentComment == null) {
comment.setPostAndSiteUser(post, siteUser);
comment.setPostAndSiteUser(post, siteUser.getId());
Copy link
Contributor

Choose a reason for hiding this comment

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

저도 함수명 다 SiteUser 대신 SiteUserId로 바꾸는 거 동의합니다~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다!


private Boolean isOwner(Comment comment, SiteUser siteUser) {
return comment.getSiteUser().getId().equals(siteUser.getId());
return Objects.equals(comment.getSiteUserId(), siteUser.getId());
Copy link
Contributor

Choose a reason for hiding this comment

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

getSiteUserId가 long으로 바뀌어서 Objects.equals를 쓰신거군요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 맞습니다!

@OneToMany(mappedBy = "post", cascade = CascadeType.ALL, orphanRemoval = true)
private List<PostImage> postImageList = new ArrayList<>();

@BatchSize(size = 5)
Copy link
Contributor

Choose a reason for hiding this comment

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

이건 왜 추가된건가요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

저도 궁금합니다~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

확인 결과 수정 과정에서 헷갈린 것 같습니다... 수정하였습니다!

this.siteUser.getPostList().remove(this);
this.siteUser = null;
}
public void setBoardAndSiteUser(String boardCode, long siteUserId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

이것도 함수명 바꾸는 게 좋을 거 같습니다~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다!

private long siteUserId;

public void setPostAndSiteUser(Post post, SiteUser siteUser) {
public void setPostAndSiteUser(Post post, long siteuserId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

여기도요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다!

public interface PostRepository extends JpaRepository<Post, Long> {

@EntityGraph(attributePaths = {"postImageList", "board", "siteUser"})
List<Post> findByBoardCode(String boardCode);
Copy link
Contributor

Choose a reason for hiding this comment

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

개행!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다!

Comment on lines +48 to +49
@Column
private long siteUserId;
Copy link
Contributor

Choose a reason for hiding this comment

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

import com.example.solidconnection.siteuser.domain.SiteUser;

import 제거!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다!

* siteUser 에 postList 를 FetchType.EAGER 로 설정할 것인지,
* post 와 siteUser 사이의 양방향을 끊을 것인지 생각해봐야한다.
*/
SiteUser siteUser1 = siteUserRepository.findById(siteUser.getId()).orElseThrow(() -> new CustomException(USER_NOT_FOUND));
Copy link
Contributor

Choose a reason for hiding this comment

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

private final SiteUserRepository siteUserRepository;는 사용하지 않게 되었으니 제거하면 좋을 거 같습니다~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다!

* siteUser 에 postList 를 FetchType.EAGER 로 설정할 것인지,
* post 와 siteUser 사이의 양방향을 끊을 것인지 생각해봐야한다.
*/
SiteUser siteUser1 = siteUserRepository.findById(siteUser.getId()).orElseThrow(() -> new CustomException(USER_NOT_FOUND));
Copy link
Contributor

Choose a reason for hiding this comment

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

여기도요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다!

Comment on lines 3 to 5
import com.example.solidconnection.community.comment.domain.Comment;
import com.example.solidconnection.community.post.domain.Post;
import com.example.solidconnection.community.post.domain.PostLike;
Copy link
Contributor

Choose a reason for hiding this comment

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

사용하지 않는 import 제거!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

수정하였습니다!

Copy link
Collaborator

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

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

모두 확인했습니다 😊
추가로, PR에서 확인해야 할 변경사항이 특정된다면

https://github.com/solid-connection/solid-connect-server/pull/372/files/5cf0660da18b617e670369e1b1289a24bbd7a170..41afcad51a93ee4446df374749d4d0e78f6ea6fd

이런식으로 링크로 "특정 범위의 커밋에 해당하는 변경사항"만 전달하는 방법이 있습니다.
첫 커밋부터 읽다가, 헤매는 시간이 있었네요 😅

Comment on lines 26 to 31
if (parentComment == null) {
comment.setPostAndSiteUser(post, siteUser);
comment.setPostAndSiteUser(post, siteUser.getId());
} else {
comment.setParentCommentAndPostAndSiteUser(parentComment, post, siteUser);
comment.setParentCommentAndPostAndSiteUser(parentComment, post, siteUser.getId());
}
return comment;
Copy link
Collaborator

Choose a reason for hiding this comment

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

음.. 지금보니 왜 도메인 로직이 Dto 안에 있는걸까요.. 🤔
이 부분은 다른 PR에서 리팩터링 해야겠네요.

@OneToMany(mappedBy = "post", cascade = CascadeType.ALL, orphanRemoval = true)
private List<PostImage> postImageList = new ArrayList<>();

@BatchSize(size = 5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

저도 궁금합니다~

lsy1307 added 8 commits July 8, 2025 20:39
- Long타입 long으로 수정
- collect -> toList단독으로 변경
- 컨벤션 수정
- Recomment 변경사항 원복
- getGeneralRecommendsExcludingSelected함수 OutOfRange 방지 추가
- UnivApplyInfo University fetchType LAZY로 변경
- 컨벤션 수정
- findRandomByTerm함수 nativeQuery제거 및 Pageable로 LIMIT 구현
- siteUser -> siteUserId로 변경
- 메서드명 각자 기능에 맞게 수정
- 사용하지 않는 import문 제거
- 코드 컨벤션 수정
- postLikeList에서 의미없는 BatchSize 삭제
- password nullable true -> false로 수정
private LocalDate quitedAt;

@Column(nullable = true)
@Column(nullable = false)
Copy link
Collaborator

@nayonsoso nayonsoso Jul 9, 2025

Choose a reason for hiding this comment

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

Suggested change
@Column(nullable = false)
@Column(nullable = true)

OAuth 회원가입 사용자는 비밀번호가 없습니다...
PR의 변경 범위에 해당되는게 아니라면 수정하지 말아주세요 🥲
이게 머지되면 큰일날 뻔 했습니다...!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

헉... 제가 수정하면서 잘못 건드린 줄 알았습니다... 수정했습니다!

lsy1307 added 2 commits July 10, 2025 19:28
- password nullable 변경사항 취소

This reverts commit 6fcc903.
Copy link
Collaborator

@nayonsoso nayonsoso left a comment

Choose a reason for hiding this comment

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

정말 너무 고생 많으셨습니다~~!!!!
approve 드립니다!

image

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.

SiteUser에 불필요한 import가 아직 있는 거 같은데 그거만 제거해주시겠어요? 고생하셨습니다~
간단한 거니 approve 미리 해두겠습니다!

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.

고생하셨습니다 ~!

@lsy1307 lsy1307 merged commit cfe8489 into solid-connection:develop Jul 10, 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: Community 연관관계 수정/삭제

4 participants