Skip to content

Commit

Permalink
Merge pull request #131 from chanu2/main
Browse files Browse the repository at this point in the history
🎨: 방 조회시 순서 lastModifyDate로 변경
  • Loading branch information
Leehunil authored Oct 29, 2023
2 parents 6b984e2 + 782353f commit 65e6c1a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,18 @@
public interface ReservationRepository extends JpaRepository<Reservation, Long>,ReservationRepositoryCustom {
@Override
Optional<Reservation> findById(Long id);
Slice<Reservation> findSliceBy(Pageable pageable);

Slice<Reservation> findSliceByOrderByLastModifyDateDesc(Pageable pageable);

List<Reservation> findTop5ByOrderByIdDesc();

@Query("select distinct r from Reservation r"+
" join fetch r.participations p"+
" where p.user.id = :userId order by r.createdDate desc")
" where p.user.id = :userId order by r.lastModifyDate desc")
List<Reservation> findParticipatedReservation(@Param("userId") Long userId);

@Query("select distinct r from Reservation r"+
" join fetch r.participations p"+
" where p.user.id = :userId order by r.createdDate desc")
Slice<Reservation> findParticipatedReservationTest(@Param("userId") Long userId);

@Query("select distinct r from Reservation r"+
" where r.user.id = :userId order by r.createdDate desc")
" where r.user.id = :userId order by r.lastModifyDate desc")
List<Reservation> findReservedByMe(@Param("userId") Long userId);


}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public ReservationResponse updateReservation(Long reservationId, UpdateReservati
public Slice<ReservationBriefInfoDto> findAllReservation(PageRequest pageRequest) {

Slice<Reservation> sliceReservation =
reservationRepository.findSliceBy(pageRequest);
reservationRepository.findSliceByOrderByLastModifyDateDesc(pageRequest);

return sliceReservation.map(reservation -> new ReservationBriefInfoDto(reservation.getReservationBaseInfoVo()));
}
Expand Down

0 comments on commit 65e6c1a

Please sign in to comment.