Skip to content

Commit 85baef0

Browse files
committed
feat: QA 반영
1 parent be5389f commit 85baef0

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/main/java/be/dash/dashserver/core/domain/lesson/service/LessonService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ public List<Genre> getPopularGenres() {
5353
public Lessons searchBySortOption(LessonSortOption sortOption) {
5454
List<Lesson> activeLessons = lessonRepository.findActiveLessons(LocalDateTime.now())
5555
.stream()
56-
.limit(15)
5756
.toList();
5857
Lessons lessons = new Lessons(activeLessons);
59-
return lessons.sort(sortOption);
58+
Lessons sortedLessons = lessons.sort(sortOption);
59+
return new Lessons(sortedLessons.lessons().stream()
60+
.limit(15)
61+
.toList());
6062
}
6163

6264
public Lesson findById(long lessonId) {

src/main/java/be/dash/dashserver/database/core/reservation/ReservationJpaRepository.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ SELECT COUNT(r)
5353
int countPastReservationsByMemberId(@Param("memberId") Long memberId, @Param("now") LocalDateTime now);
5454

5555
@Modifying
56-
@Query("UPDATE ReservationJpaEntity r SET r.status = :status WHERE r.id = :reservationId")
57-
int updateStatusById(@Param("reservationId") Long reservationId, @Param("status") ReservationStatus status);
56+
@Query("UPDATE ReservationJpaEntity r SET r.status = :status, r.updatedAt = :now WHERE r.id = :reservationId")
57+
int updateStatusById(@Param("reservationId") Long reservationId,
58+
@Param("status") ReservationStatus status,
59+
@Param("now") LocalDateTime now);
5860

5961
List<ReservationJpaEntity> findByStatus(ReservationStatus status);
6062

src/main/java/be/dash/dashserver/database/core/reservation/ReservationRepositoryAdapter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,32 @@ public int countPastReservationsByMemberId(Long memberId, LocalDateTime now) {
6666

6767
@Override
6868
public void pendingApprove(Long reservationId) {
69-
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.PENDING_APPROVAL);
69+
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.PENDING_APPROVAL, LocalDateTime.now());
7070
}
7171

7272
@Override
7373
public void approve(Long reservationId) {
74-
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.APPROVED);
74+
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.APPROVED, LocalDateTime.now());
7575
}
7676

7777
@Override
7878
public void pendingCancel(Long reservationId) {
79-
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.PENDING_CANCELLATION);
79+
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.PENDING_CANCELLATION, LocalDateTime.now());
8080
}
8181

8282
@Override
8383
public void cancel(Long reservationId) {
84-
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.CANCELLED);
84+
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.CANCELLED, LocalDateTime.now());
8585
}
8686

8787
@Override
8888
public void inProgress(Long reservationId) {
89-
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.IN_PROGRESS);
89+
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.IN_PROGRESS, LocalDateTime.now());
9090
}
9191

9292
@Override
9393
public void completed(Long reservationId) {
94-
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.COMPLETED);
94+
reservationJpaRepository.updateStatusById(reservationId, ReservationStatus.COMPLETED, LocalDateTime.now());
9595
}
9696

9797
@Override

0 commit comments

Comments
 (0)