From 7bc4b1e4121b78b2a685469bb0931a3ca5dc7436 Mon Sep 17 00:00:00 2001 From: haedoang Date: Tue, 26 Dec 2023 22:05:16 +0900 Subject: [PATCH] sort location api --- .../com/koliving/api/location/application/LocationService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/koliving/api/location/application/LocationService.java b/src/main/java/com/koliving/api/location/application/LocationService.java index 0da8460b..c6e07487 100644 --- a/src/main/java/com/koliving/api/location/application/LocationService.java +++ b/src/main/java/com/koliving/api/location/application/LocationService.java @@ -6,6 +6,7 @@ import com.koliving.api.location.application.dto.LocationUpdateRequest; import com.koliving.api.location.domain.Location; import com.koliving.api.location.infra.LocationRepository; +import java.util.Comparator; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -46,6 +47,7 @@ public LocationResponse findOne(Long id) { public List findAll() { return locationRepository.findAll() .stream() + .sorted(Comparator.comparing(Location::getName)) .map(LocationResponse::valueOf) .collect(Collectors.toList()); }