Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: 마이페이지 게시글 목록 조회 최신순 정렬 추가 #45

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

klaus9267
Copy link
Owner

No description provided.

@klaus9267 klaus9267 merged commit 4784328 into main Jul 31, 2024
1 check passed
final List<PostDto> postDtos = query.where(builder).fetch();
final List<PostDto> postDtos = query.where(builder)
.orderBy(post.id.desc())
.fetch();

return PageableExecutionUtils.getPage(postDtos, pageable, count::fetchOne);
}

Choose a reason for hiding this comment

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

이 코드 수정 사항에 대한 코드 리뷰는 다음과 같습니다:

버그 위험:

  • 쿼리 결과를 정렬하는 .orderBy(post.id.desc())가 추가되었으나, post.id 필드가 조인된 테이블의 이름이나 엔티티 명시를 포함하고 있는지 확인해야 합니다.
  • query 객체가 어딘가에서 정의되어 있어야 하는데 여기서는 그 부분이 코드 스니펫에 없으므로 해당 컨텍스트에 주의를 기울여야 합니다.

개선 제안:

  • 변수 또는 메소드명을 더 명확하게 작성하여 가독성을 향상시킵니다. 예를 들어, count보다 countQuery로 명명하는 것이 좋을 수 있습니다.
  • 추가적인 주석을 통해 각 라인이 수행하는 작업에 대한 설명을 추가합니다.
  • 이 코드 조각의 컨텍스트에서 어떤 데이터베이스나 ORM 프레임워크가 사용되고 있는지에 따라 적절한 최적화 방법이 있을 수 있으므로 해당 부분을 고려합니다.

코드 리뷰는 개발 환경 및 요구사항에 따라 달라질 수 있으므로 실제 시스템에 맞도록 필요한 수정을 적용하는 것이 중요합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant