Skip to content

Conversation

@TTaiJin
Copy link
Collaborator

@TTaiJin TTaiJin commented Mar 31, 2025

작성자 본인 검증 로직 엔티티 레벨로 이동 등 약간의 코드 리팩토링

다이어리 도메인 리포지터리, 서비스 테스트 추가

추후 시큐리티 쪽 완료되면 통합 테스트 구현 예정

이번 주 미디어 쪽 완료 예정

@TTaiJin TTaiJin added enhancement New feature or request refactor test 테스트 코드 추가 및 수정 PR and removed enhancement New feature or request labels Mar 31, 2025
Copy link
Collaborator

@dnzp75 dnzp75 left a comment

Choose a reason for hiding this comment

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

통합 테스트, DB테스트까지 꼼꼼하게 작성해주셨네요.

고생하셨습니다!

@sapiens2000
Copy link
Collaborator

테스트 수행 위해 잠시 닫았다가 열겠습니다.

@sapiens2000 sapiens2000 reopened this Mar 31, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 1, 2025

@github-actions
Copy link

github-actions bot commented Apr 1, 2025

Claude의 전체 변경사항 및 관련 파일에 대한 리뷰:

개선된 사항:

  • 코드 구조가 전반적으로 개선되었으며, 특히 DiaryService와 DiaryRepository의 기능이 확장되었습니다.
  • 테스트 코드가 추가되어 코드의 신뢰성이 향상되었습니다.
  • Fixture 클래스들이 추가되어 테스트 데이터 생성이 용이해졌습니다.

주요 이슈:

  1. 커서 기반 페이징 구현

    • 제안: 커서 기반 페이징의 성능을 더욱 개선할 수 있습니다. 예를 들어, 인덱스를 활용하여 쿼리 성능을 향상시킬 수 있습니다.
    @Query("SELECT d FROM Diary d WHERE d.userId = :userId AND d.visibility IN :visibilities AND d.id < :cursorId ORDER BY d.id DESC")
    List<Diary> findByUserIdAndVisibilityInAndIdLessThanOrderByIdDesc(@Param("userId") Long userId, @Param("visibilities") List<VisibilityType> visibilities, @Param("cursorId") Long cursorId, Pageable pageable);
  2. 미디어 처리 로직

    • 제안: MediaService에서 미디어 처리 로직을 더 모듈화하고, 비동기 처리를 고려해볼 수 있습니다.
    @Async
    public CompletableFuture<Void> processMediaAsync(Long diaryId, List<MediaRequestDto> mediaList) {
        // 비동기 미디어 처리 로직
    }
  3. 보안 관련 개선

    • 제안: 사용자 인증 및 권한 검사 로직을 강화할 필요가 있습니다. 예를 들어, Spring Security를 활용할 수 있습니다.
    @PreAuthorize("@diarySecurityService.canAccessDiary(#userId, #diaryId)")
    public DiaryResponseDto getDiary(Long userId, Long diaryId) {
        // 다이어리 조회 로직
    }

관련 파일에 대한 영향 분석:

  • DiaryService의 변경으로 인해 DiaryController와 CommentService 등 관련 서비스들의 로직 수정이 필요할 수 있습니다.
  • CustomDiaryRepositoryImpl의 변경은 쿼리 성능에 영향을 줄 수 있으므로, 성능 테스트가 필요할 수 있습니다.
  • MediaService의 변경은 파일 업로드 및 처리 로직에 영향을 줄 수 있으므로, 관련 기능들의 테스트가 필요합니다.

전반적인 의견:
코드 품질이 전반적으로 향상되었으며, 특히 테스트 커버리지가 증가한 점이 긍정적입니다. 다만, 성능 최적화와 보안 강화에 더 주의를 기울일 필요가 있습니다.

@TTaiJin TTaiJin merged commit 70fa4f2 into develop Apr 1, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor test 테스트 코드 추가 및 수정 PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants