Skip to content

Commit

Permalink
♻️ refactor/#143 : 티켓 만료일 기준 빠른순 정렬
Browse files Browse the repository at this point in the history
Signed-off-by: EunJiJung <[email protected]>
  • Loading branch information
bianbbc87 committed Nov 23, 2024
1 parent 4f3266d commit fa64146
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ReadTicketResponseDto execute(
User user = userRepository.findById(accountId)
.orElseThrow(() -> new CommonException(ErrorCode.NOT_FOUND_RESOURCE));

Page<Ticket> ticketsPage = ticketRepository.findByUserOrderByExpirationDateDesc(user, pageable);
Page<Ticket> ticketsPage = ticketRepository.findByUserOrderByExpirationDateAsc(user, pageable);

// dto로 변환
List<ReadTicketResponseDto.TicketDto> ticketDtos = ticketsPage.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public interface TicketRepository extends JpaRepository<Ticket, Long> {

// user로 Ticket 조회, expirationDate를 ASC로 정렬
Page<Ticket> findByUserOrderByExpirationDateDesc(User user, Pageable pageable);
Page<Ticket> findByUserOrderByExpirationDateAsc(User user, Pageable pageable);

// user로 Ticket 수 조회
Long countByUser(User user);
Expand Down

0 comments on commit fa64146

Please sign in to comment.