diff --git a/src/main/java/ice/spot/dto/boardingrecord/response/BoardingRecordListResponse.java b/src/main/java/ice/spot/dto/boardingrecord/response/BoardingRecordListResponse.java index f6bf320..b2ace95 100644 --- a/src/main/java/ice/spot/dto/boardingrecord/response/BoardingRecordListResponse.java +++ b/src/main/java/ice/spot/dto/boardingrecord/response/BoardingRecordListResponse.java @@ -1,5 +1,6 @@ package ice.spot.dto.boardingrecord.response; +import com.fasterxml.jackson.annotation.JsonProperty; import ice.spot.dto.user.response.PersonResponse; import lombok.Builder; @@ -7,8 +8,10 @@ @Builder public record BoardingRecordListResponse( + @JsonProperty("person") PersonResponse personResponse, + @JsonProperty("records") List boardingRecordResponseList ) { } diff --git a/src/main/java/ice/spot/dto/parkingLot/response/ParkingLotResponseList.java b/src/main/java/ice/spot/dto/parkingLot/response/ParkingLotResponseList.java new file mode 100644 index 0000000..cee92e8 --- /dev/null +++ b/src/main/java/ice/spot/dto/parkingLot/response/ParkingLotResponseList.java @@ -0,0 +1,18 @@ +package ice.spot.dto.parkingLot.response; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Builder; + +import java.util.List; + +@Builder +public record ParkingLotResponseList( + @JsonProperty("parkingLotList") + List parkingLotResponseList +) { + public static ParkingLotResponseList of(final List parkingLotResponse) { + return ParkingLotResponseList.builder() + .parkingLotResponseList(parkingLotResponse) + .build(); + } +} diff --git a/src/main/java/ice/spot/service/ParkingLotService.java b/src/main/java/ice/spot/service/ParkingLotService.java index 730b4bb..83ec06f 100644 --- a/src/main/java/ice/spot/service/ParkingLotService.java +++ b/src/main/java/ice/spot/service/ParkingLotService.java @@ -1,6 +1,7 @@ package ice.spot.service; import ice.spot.dto.parkingLot.response.ParkingLotResponse; +import ice.spot.dto.parkingLot.response.ParkingLotResponseList; import ice.spot.repository.ParkingLotRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -19,7 +20,7 @@ public class ParkingLotService { private final ParkingLotRepository parkingLotRepository; @Transactional(readOnly = true) - public List parkingLotList(Double lat, Double lon) { + public ParkingLotResponseList parkingLotList(Double lat, Double lon) { List parkingLotResponseList = new ArrayList<>(parkingLotRepository.findAll().stream() .map(parkingLot -> ParkingLotResponse.builder() @@ -41,6 +42,6 @@ public int compare(ParkingLotResponse o1, ParkingLotResponse o2) { } }); - return parkingLotResponseList.subList(0, 5); + return ParkingLotResponseList.of(parkingLotResponseList.subList(0, 5)); } }