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

[Feat] 게시글 목록 조회 수정 #141

Merged
merged 5 commits into from
Jan 24, 2025
Merged

Conversation

dona722
Copy link
Collaborator

@dona722 dona722 commented Jan 23, 2025

🚀 Pull Request

[Feat] 게시글 목록 조회 수정

#️⃣ 연관된 이슈

#128

📋 작업 내용

게시글 목록 조회수 순 정렬
삭제 처리된 글 조회 제한
인기 게시글 30일 필터링

🔧 변경된 코드 설명

  • 'SortingType' enum 클래스 추가
  • 'PostRepository' 카테고리 별 조회수 순 게시글 조회 메서드
@Query("""
   	    SELECT p FROM Post p
   	    WHERE (p.id < :cursorId OR :cursorId IS NULL)
   	    AND p.communityCategory = :category
   	    AND p.isVisible = true
   	    AND p.isDeleted = false
   	    ORDER BY p.viewCount DESC, p.id DESC
   	""")
   List<Post> findMostViewedPostsByCategory(
   	@Param("category") CommunityCategory category,
   	@Param("cursorId") Long cursorId,
   	Pageable pageable
   );
  • 'PostDetailService' 삭제 처리된 글 조회 제한
  • 'InsaengService' '풍수로 보ㄴㅡㄴ 길흉' key값 수정

✅ 테스트 여부

이 PR에 포함된 코드에 대해 테스트가 진행되었는지 작성해 주세요.
예시: 단위 테스트 작성 완료, 통합 테스트 완료, UI 테스트 진행 중

  • 테스트 코드 실행 여부
  • 서버 실행 여부
  • 스웨거 테스트 여부

👽 비고

기타 알림 사항이 있으면 적어주세요.

@dona722 dona722 linked an issue Jan 23, 2025 that may be closed by this pull request
ORDER BY (p.viewCount * 7) + (p.likeCount * 3) DESC, p.id DESC
""")
List<Post> findPopularPosts(
@Param("cursorId") Long cursorId,
@Param("thirtyDaysAgo") LocalDateTime thirtyDaysAgo,
Pageable pageable
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pageable->커서기반으로 리팩토링 부탁합니다!

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
Collaborator

@yr0202 yr0202 left a comment

Choose a reason for hiding this comment

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

👍👍👍👍

@dona722 dona722 merged commit ef5c5f3 into dev Jan 24, 2025
2 checks passed
@dona722 dona722 deleted the feature/post-list-sorting-#128 branch January 27, 2025 06:34
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.

[Feat] 게시글 목록 조회수 순으로 조회
3 participants