prepare the inbound to calculate the different parameters
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Delete,
|
||||
@@ -44,15 +43,44 @@ export class InboundController {
|
||||
} 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>(
|
||||
input: ControllerInput | ControllerInputDto,
|
||||
): 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 {
|
||||
|
||||
Reference in New Issue
Block a user