Skip to content

Commit a91a8dc

Browse files
authored
Merge pull request #117 from Team-NumberOne/fix/api4
fix: api 버그수정
2 parents 8e4753f + 9103a3b commit a91a8dc

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • src/main/kotlin/com/numberone/daepiro/domain/home/service

src/main/kotlin/com/numberone/daepiro/domain/home/service/HomeService.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ class HomeService(
5151
user.userAddresses.map { it.address }+user.address!!,
5252
user.userDisasterTypes.map { it.disasterType }
5353
)
54+
val sortedDisasters = disasters.sortedByDescending { it.generatedAt }
5455
val twentyFourHoursAgo = LocalDateTime.now().minusHours(24)
55-
val disaster = disasters.firstOrNull()
56+
val disaster = sortedDisasters.firstOrNull()
5657
?: throw CustomException(NOT_FOUND_OCCURRED_DISASTER)
5758
if (disaster.generatedAt.isBefore(twentyFourHoursAgo))
5859
throw CustomException(NOT_FOUND_OCCURRED_DISASTER)

0 commit comments

Comments
 (0)