|
@@ -27,8 +27,10 @@ import { Waypoint } from '../generic/models/waypoint.model';
|
|
|
import { WaypointDto } from '../generic/dto/waypoint.dto';
|
|
|
import { Coordinate } from '../generic/models/coordinate.model';
|
|
|
import { CoordinateDto } from '../generic/dto/coordinate.dto';
|
|
|
-import { WaypointConverter } from '../generic/converters';
|
|
|
+import { CoordinateConverter, WaypointConverter } from '../generic/converters';
|
|
|
import { ActiveRunwaysDto } from './dto/activerunways.dto';
|
|
|
+import { Runway } from './models/runway.model';
|
|
|
+import { RunwayDto } from './dto/runway.dto';
|
|
|
|
|
|
@Controller('airport')
|
|
|
export class AirportController {
|
|
@@ -118,6 +120,17 @@ export class AirportController {
|
|
|
} as T;
|
|
|
}
|
|
|
|
|
|
+ private static convertRunways<T>(runways: Runway[] | RunwayDto[]): T[] {
|
|
|
+ const retval: T[] = [];
|
|
|
+ runways.forEach((runway) =>
|
|
|
+ retval.push({
|
|
|
+ identifier: runway.identifier,
|
|
|
+ threshold: CoordinateConverter.convert(runway.threshold),
|
|
|
+ } as T),
|
|
|
+ );
|
|
|
+ return retval;
|
|
|
+ }
|
|
|
+
|
|
|
private static airportToAirportDto(airport: Airport): AirportDto {
|
|
|
if (!airport) return null;
|
|
|
|
|
@@ -127,6 +140,7 @@ export class AirportController {
|
|
|
airport.location,
|
|
|
),
|
|
|
elevation: airport.elevation,
|
|
|
+ runways: AirportController.convertRunways(airport.runways),
|
|
|
upperConstraints: AirportController.convertConstraints<ConstraintDto>(
|
|
|
airport.upperConstraints,
|
|
|
),
|
|
@@ -156,6 +170,7 @@ export class AirportController {
|
|
|
airport.location,
|
|
|
),
|
|
|
elevation: airport.elevation,
|
|
|
+ runways: AirportController.convertRunways(airport.runways),
|
|
|
upperConstraints: AirportController.convertConstraints<Constraint>(
|
|
|
airport.upperConstraints,
|
|
|
),
|