From be6a81609e79b021a316fba00e98f0d49ad90f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Erik=20St=C3=B8wer?= Date: Tue, 4 Jun 2024 21:58:10 +0200 Subject: [PATCH] Deprecate fields with "bike" in the name, add new fields --- .../mapper/entitymapper/StationMapper.java | 10 ++++++++++ .../entur/lamassu/model/entities/Station.java | 18 ++++++++++++++++++ src/main/resources/graphql/schema.graphqls | 6 ++++-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMapper.java b/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMapper.java index c633ccf3..3a98dc9a 100644 --- a/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMapper.java +++ b/src/main/java/org/entur/lamassu/mapper/entitymapper/StationMapper.java @@ -147,6 +147,11 @@ public Station mapStation( ? stationStatus.getNumVehiclesAvailable() : null ); + station.setNumVehiclesAvailable( + stationStatus.getNumVehiclesAvailable() != null + ? stationStatus.getNumVehiclesAvailable() + : null + ); station.setVehicleTypesAvailable( stationStatus.getVehicleTypesAvailable() != null ? mapVehicleTypesAvailable( @@ -162,6 +167,11 @@ public Station mapStation( ? stationStatus.getNumVehiclesDisabled() : null ); + station.setNumVehiclesDisabled( + stationStatus.getNumVehiclesDisabled() != null + ? stationStatus.getNumVehiclesDisabled() + : null + ); station.setNumDocksAvailable( stationStatus.getNumDocksAvailable() != null ? stationStatus.getNumDocksAvailable() diff --git a/src/main/java/org/entur/lamassu/model/entities/Station.java b/src/main/java/org/entur/lamassu/model/entities/Station.java index 6175df85..a72a2adf 100644 --- a/src/main/java/org/entur/lamassu/model/entities/Station.java +++ b/src/main/java/org/entur/lamassu/model/entities/Station.java @@ -45,8 +45,10 @@ public class Station implements LocationEntity { private Boolean isChargingStation; private RentalUris rentalUris; private Integer numBikesAvailable; + private Integer numVehiclesAvailable; private List vehicleTypesAvailable; private Integer numBikesDisabled; + private Integer numVehiclesDisabled; private Integer numDocksAvailable; private List vehicleDocksAvailable; private Integer numDocksDisabled; @@ -236,6 +238,14 @@ public void setNumBikesAvailable(Integer numBikesAvailable) { this.numBikesAvailable = numBikesAvailable; } + public Integer getNumVehiclesAvailable() { + return numVehiclesAvailable; + } + + public void setNumVehiclesAvailable(Integer numVehiclesAvailable) { + this.numVehiclesAvailable = numVehiclesAvailable; + } + public List getVehicleTypesAvailable() { return vehicleTypesAvailable; } @@ -254,6 +264,14 @@ public void setNumBikesDisabled(Integer numBikesDisabled) { this.numBikesDisabled = numBikesDisabled; } + public Integer getNumVehiclesDisabled() { + return numVehiclesDisabled; + } + + public void setNumVehiclesDisabled(Integer numVehiclesDisabled) { + this.numVehiclesDisabled = numVehiclesDisabled; + } + public Integer getNumDocksAvailable() { return numDocksAvailable; } diff --git a/src/main/resources/graphql/schema.graphqls b/src/main/resources/graphql/schema.graphqls index 2554152f..a4dab98d 100644 --- a/src/main/resources/graphql/schema.graphqls +++ b/src/main/resources/graphql/schema.graphqls @@ -233,9 +233,11 @@ type Station { isValetStation: Boolean isChargingStation: Boolean rentalUris: RentalUris - numBikesAvailable: Int! + numBikesAvailable: Int! @deprecated(reason: "Use numVehiclesAvailable") + numVehiclesAvailable: Int! vehicleTypesAvailable: [VehicleTypeAvailability] - numBikesDisabled: Int + numBikesDisabled: Int @deprecated(reason: "Use numVehiclesDisabled") + numVehiclesDisabled: Int numDocksAvailable: Int vehicleDocksAvailable: [VehicleDocksAvailability] numDocksDisabled: Int