|
@@ -932,4 +932,25 @@ public class OpenAPIHandler {
|
|
|
).encode()))
|
|
).encode()))
|
|
|
.onFailure(th -> rc.fail(400, th));
|
|
.onFailure(th -> rc.fail(400, th));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void driverIdActionIdGET(RoutingContext rc) {
|
|
|
|
|
+ String host = hostURLFull(rc.request());
|
|
|
|
|
+
|
|
|
|
|
+ int driverId = Integer.parseInt(rc.pathParam("driverId"));
|
|
|
|
|
+ int actionId = Integer.parseInt(rc.pathParam("actionId"));
|
|
|
|
|
+
|
|
|
|
|
+ List<String> paramNavigationLinks = rc.queryParam("navigationLinks");
|
|
|
|
|
+ boolean navigationLinks = paramNavigationLinks.isEmpty() ? DEFAULT_NAVIGATION_LINKS : parseBoolean(paramNavigationLinks.get(0));
|
|
|
|
|
+
|
|
|
|
|
+ repo.findActionByIdAndDriverId(actionId, driverId)
|
|
|
|
|
+ .onSuccess(a -> rc.response().end((navigationLinks ? JsonObject.of(
|
|
|
|
|
+ "self@NavigationLink", String.format("%s/drivers/%d/actions/%d", host, driverId, a.getId()),
|
|
|
|
|
+ "Driver@NavigationLink", String.format("%s/drivers/%d", host, driverId),
|
|
|
|
|
+ "Units@NavigationLink", String.format("%s/drivers/%d/actions/%d/units", host, driverId, a.getId())
|
|
|
|
|
+ ) : JsonObject.of()).mergeIn(JsonObject.of(
|
|
|
|
|
+ "id", a.getId(),
|
|
|
|
|
+ "name", a.getName()
|
|
|
|
|
+ )).encode())
|
|
|
|
|
+ .onFailure(th -> rc.fail(400, th)));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|