Skip to content

Commit

Permalink
refactor: 주간스케줄 반환 정렬 (#51)
Browse files Browse the repository at this point in the history
* fix: 주간 스케줄 저장 시 500에러 해결

* chore: 스케줄 시간 반환 포맷 변경

* chore: Reservation 엔티티 FK nullable 작성

* chore: nullable 삭제

* refactor: 주간스케줄 반환 정렬
  • Loading branch information
yuuuyeonho authored Feb 7, 2025
1 parent d6dbbce commit 40fa117
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.keunsori.keunsoriserver.domain.admin.reservation.domain.WeeklySchedule;
import com.keunsori.keunsoriserver.global.util.DayOfWeekUtil;
import lombok.Getter;

import java.time.format.DateTimeFormatter;

Expand All @@ -19,4 +20,8 @@ public static WeeklyScheduleResponse from(WeeklySchedule weeklySchedule){
weeklySchedule.getEndTime().format(DateTimeFormatter.ofPattern("HH:mm"))
);
}

public int getDayOfWeekNum() {
return dayOfWeekNum;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;

Expand All @@ -36,7 +37,8 @@ public class AdminReservationService {

public List<WeeklyScheduleResponse> findAllWeeklySchedules() {
return weeklyScheduleRepository.findAll()
.stream().map(WeeklyScheduleResponse::from).toList();
.stream().map(WeeklyScheduleResponse::from)
.sorted(Comparator.comparing(WeeklyScheduleResponse::getDayOfWeekNum)).toList();
}

@Transactional
Expand Down

0 comments on commit 40fa117

Please sign in to comment.