|
@@ -1,5 +1,4 @@
|
|
import {
|
|
import {
|
|
- Body,
|
|
|
|
Controller,
|
|
Controller,
|
|
Get,
|
|
Get,
|
|
Delete,
|
|
Delete,
|
|
@@ -44,15 +43,44 @@ export class InboundController {
|
|
} as T;
|
|
} as T;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static waypointsDtoToPredictedWaypoints(
|
|
|
|
+ waypoints: WaypointDto[],
|
|
|
|
+ ): PredictedWaypoint[] {
|
|
|
|
+ const retval: PredictedWaypoint[] = [];
|
|
|
|
+ waypoints.forEach((waypoint) =>
|
|
|
|
+ retval.push({
|
|
|
|
+ waypoint: WaypointConverter.convert(waypoint),
|
|
|
|
+ altitude: undefined,
|
|
|
|
+ indicatedAirspeed: undefined,
|
|
|
|
+ groundspeed: undefined,
|
|
|
|
+ plannedOverheadTime: undefined,
|
|
|
|
+ }),
|
|
|
|
+ );
|
|
|
|
+ return retval;
|
|
|
|
+ }
|
|
|
|
+
|
|
private static convertControllerInput<T>(
|
|
private static convertControllerInput<T>(
|
|
input: ControllerInput | ControllerInputDto,
|
|
input: ControllerInput | ControllerInputDto,
|
|
): T {
|
|
): T {
|
|
- return {
|
|
|
|
- reportedTime: input.reportedTime,
|
|
|
|
- remainingRoute: WaypointConverter.convertList(input.remainingRoute),
|
|
|
|
- requestedRunway: input.requestedRunway,
|
|
|
|
- plannedStand: input.plannedStand,
|
|
|
|
- } as T;
|
|
|
|
|
|
+ if (input instanceof ControllerInputDto) {
|
|
|
|
+ return {
|
|
|
|
+ reportedTime: input.reportedTime,
|
|
|
|
+ remainingRoute: InboundController.waypointsDtoToPredictedWaypoints(
|
|
|
|
+ input.remainingRoute,
|
|
|
|
+ ),
|
|
|
|
+ requestedRunway: input.requestedRunway,
|
|
|
|
+ plannedStand: input.plannedStand,
|
|
|
|
+ } as T;
|
|
|
|
+ } else {
|
|
|
|
+ return {
|
|
|
|
+ reportedTime: input.reportedTime,
|
|
|
|
+ remainingRoute: InboundController.convertPredictedWaypoints(
|
|
|
|
+ input.remainingRoute,
|
|
|
|
+ ),
|
|
|
|
+ requestedRunway: input.requestedRunway,
|
|
|
|
+ plannedStand: input.plannedStand,
|
|
|
|
+ } as T;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private static convertFlightState<T>(input: FlightState | FlightStateDto): T {
|
|
private static convertFlightState<T>(input: FlightState | FlightStateDto): T {
|