Skip to content

Commit

Permalink
♻️ refactor/#139 : 나의 식권 조회 DESC로 변경
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 1c9ffe8 commit 7ee3081
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.findByUserOrderByExpirationDateAsc(user, pageable);
Page<Ticket> ticketsPage = ticketRepository.findByUserOrderByExpirationDateDesc(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> findByUserOrderByExpirationDateAsc(User user, Pageable pageable);
Page<Ticket> findByUserOrderByExpirationDateDesc(User user, Pageable pageable);

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

0 comments on commit 7ee3081

Please sign in to comment.