Skip to content

Commit

Permalink
Add rideStartAllowed and rideEndAllowed to gql api
Browse files Browse the repository at this point in the history
  • Loading branch information
testower committed Jun 4, 2024
1 parent 22b568b commit 9d7c3f8
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ private org.entur.lamassu.model.entities.GeofencingZones.Rule mapRule(GBFSRule r
var mapped = new org.entur.lamassu.model.entities.GeofencingZones.Rule();
mapped.setVehicleTypeIds(rule.getVehicleTypeIds());
mapped.setRideAllowed(rule.getRideStartAllowed() && rule.getRideEndAllowed());
mapped.setRideStartAllowed(rule.getRideStartAllowed());
mapped.setRideEndAllowed(rule.getRideEndAllowed());
mapped.setRideThroughAllowed(rule.getRideThroughAllowed());
mapped.setMaximumSpeedKph(
rule.getMaximumSpeedKph() != null ? rule.getMaximumSpeedKph() : null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ public static class Rule implements Serializable {

private List<String> vehicleTypeIds;
private Boolean rideAllowed;
private Boolean rideStartAllowed;
private Boolean rideEndAllowed;
private Boolean rideThroughAllowed;
private Integer maximumSpeedKph;
private Boolean stationParking;
Expand All @@ -168,6 +170,22 @@ public void setRideAllowed(Boolean rideAllowed) {
this.rideAllowed = rideAllowed;
}

public Boolean getRideStartAllowed() {
return rideStartAllowed;
}

public void setRideStartAllowed(Boolean rideStartAllowed) {
this.rideStartAllowed = rideStartAllowed;
}

public Boolean getRideEndAllowed() {
return rideEndAllowed;
}

public void setRideEndAllowed(Boolean rideEndAllowed) {
this.rideEndAllowed = rideEndAllowed;
}

public Boolean getRideThroughAllowed() {
return rideThroughAllowed;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/graphql/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ type GeofencingZoneProperties {

type GeofencingZoneRule {
vehicleTypeIds: [String]
rideAllowed: Boolean!
rideAllowed: Boolean! @deprecated(reason: "Use rideStartAllowed and rideEndAllowed")
rideStartAllowed: Boolean!
rideEndAllowed: Boolean!
rideThroughAllowed: Boolean!
maximumSpeedKph: Int
stationParking: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ public void testGeofencingZones() throws IOException {
);
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals("testatlantis", response.get("$.data.geofencingZones[0].systemId"));
assertEquals(
"true",
response.get(
"$.data.geofencingZones[0].geojson.features[0].properties.rules[0].rideStartAllowed"
)
);
assertEquals(
"true",
response.get(
"$.data.geofencingZones[0].geojson.features[0].properties.rules[0].rideEndAllowed"
)
);
}

@Test
Expand Down
4 changes: 3 additions & 1 deletion src/test/resources/geofencing_zones_query.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
name
rules {
rideAllowed
rideStartAllowed
rideEndAllowed
rideThroughAllowed
}
}
}
}
}
}
}

0 comments on commit 9d7c3f8

Please sign in to comment.