Skip to content

Commit

Permalink
🐛 [#97] fix: checkLastPage 파라미터와 반환 타입 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
strongmhk committed Aug 17, 2024
1 parent d9fa48c commit c239b08
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public CommnuityPost findByIdFetchJoinWithUser(Long postId) {

@Override
public Slice<Tuple> findAllPostsByUser(User user, LocalDateTime cursorDateTime, Pageable pageable, PostTypeEnum type) {
List<Tuple> userPosts = jpaQueryFactory.select(post.id, post.user, post.title, post.body, post.type, post.status, post.hit, post.likeCnt, post.createdAt)
.from(post)
.where(post.user.eq(user), (postTypeEq(type))
,(post.createdAt.before(cursorDateTime))
List<Tuple> userPosts = jpaQueryFactory.select(commnuityPost.id, commnuityPost.user, commnuityPost.title, commnuityPost.body, commnuityPost.type, commnuityPost.status, commnuityPost.hit, commnuityPost.likeCnt, commnuityPost.createdAt)
.from(commnuityPost)
.where(commnuityPost.user.eq(user), (postTypeEq(type))
,(commnuityPost.createdAt.before(cursorDateTime))
)
.orderBy(post.createdAt.desc())
.orderBy(commnuityPost.createdAt.desc())
.limit(pageable.getPageSize() + 1)
.fetch();

Expand Down Expand Up @@ -125,7 +125,7 @@ private BooleanExpression searchKeyword(String keyword) {
: null;
}

private Slice<CommnuityPost> checkLastPage(Pageable pageable, List<CommnuityPost> postList) {
private <T> Slice<T> checkLastPage(Pageable pageable, List<T> postList) {
boolean hasNext = false;

// (조회한 결과 개수 > 요청한 페이지 사이즈) 이면 뒤에 데이터가 더 존재함
Expand Down

0 comments on commit c239b08

Please sign in to comment.