Skip to content

Commit 9f3c116

Browse files
committed
✨ Change: sorting criteria for ski resort query (by ID → by opening date)
#25
1 parent 01d51b1 commit 9f3c116

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/kotlin/nexters/weski/ski_resort/SkiResortRepository.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ package nexters.weski.ski_resort
22

33
import org.springframework.data.jpa.repository.JpaRepository
44

5-
interface SkiResortRepository : JpaRepository<SkiResort, Long>
5+
interface SkiResortRepository : JpaRepository<SkiResort, Long> {
6+
fun findAllByOrderByOpeningDateAsc(): List<SkiResort>
7+
}

src/main/kotlin/nexters/weski/ski_resort/SkiResortService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class SkiResortService(
1111
private val dailyWeatherRepository: DailyWeatherRepository
1212
) {
1313
fun getAllSkiResortsAndWeather(): List<SkiResortResponseDto> {
14-
val skiResorts = skiResortRepository.findAll()
14+
val skiResorts = skiResortRepository.findAllByOrderByOpeningDateAsc()
1515
return skiResorts.map { skiResort ->
1616
val currentWeather = currentWeatherRepository.findBySkiResortResortId(skiResort.resortId)
1717
val weeklyWeather = dailyWeatherRepository.findAllBySkiResortResortId(skiResort.resortId)

0 commit comments

Comments
 (0)