Skip to content

Commit

Permalink
feat: findFollowingProjects 메서드에도 정렬 부분 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
baekhangyeol committed Nov 27, 2023
1 parent 914c1ae commit 633fe63
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ public Page<Project> searchProjectsWith(Pageable pageable, String projectName, S

@Override
public Page<Project> findFollowingProjects(Pageable pageable, Long fromId) {
List<OrderSpecifier> orders = QueryDslUtil.getAllOrderSpecifiers(pageable, project.getMetadata().getName());
List<Project> fetch = jpaQueryFactory.selectFrom(project)
.where(project.member.id.in(
select(follow.toId).from(follow).where(follow.fromId.eq(fromId)
)))
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(orders.stream().toArray(OrderSpecifier[]::new))
.fetch();
JPAQuery<Long> count = jpaQueryFactory
.select(project.count())
Expand Down

0 comments on commit 633fe63

Please sign in to comment.