add some description entries for the UI

此提交包含在:
Sven Czarnian
2022-11-01 02:00:49 +01:00
父節點 42235e6e17
當前提交 bb9044698d
共有 5 個檔案被更改,包括 71 行新增8 行删除

查看文件

@@ -31,6 +31,7 @@ import { CoordinateConverter, WaypointConverter } from '../generic/converters';
import { ActiveRunwaysDto } from './dto/activerunways.dto';
import { Runway } from './models/runway.model';
import { RunwayDto } from './dto/runway.dto';
import { AirportOverviewDto } from './dto/airportoverview.dto';
@Controller('airport')
export class AirportController {
@@ -136,6 +137,8 @@ export class AirportController {
return {
icao: airport.icao,
name: airport.name,
flightInformationRegion: airport.flightInformationRegion,
location: WaypointConverter.convert<WaypointDto, CoordinateDto>(
airport.location,
),
@@ -166,6 +169,8 @@ export class AirportController {
return {
icao: airport.icao,
name: airport.name,
flightInformationRegion: airport.flightInformationRegion,
location: WaypointConverter.convert<Waypoint, Coordinate>(
airport.location,
),
@@ -241,14 +246,14 @@ export class AirportController {
});
}
@Get('/allCodes')
@Get('/all')
@ApiResponse({
status: 200,
description: 'All available airports',
type: [String],
type: [AirportOverviewDto],
})
async allCodes(): Promise<string[]> {
return this.airportService.airportsList();
async all(): Promise<AirportOverviewDto[]> {
return this.airportService.allAirports();
}
@Get('/get')

查看文件

@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { ActiveRunwaysDto } from './dto/activerunways.dto';
import { AirportOverviewDto } from './dto/airportoverview.dto';
import { Airport, AirportDocument } from './models/airport.model';
@Injectable()
@@ -17,11 +18,17 @@ export class AirportService {
.then((response) => response && response.length !== 0);
}
async airportsList(): Promise<string[]> {
async allAirports(): Promise<AirportOverviewDto[]> {
return this.airportModel.find({}).then((response) => {
const icaoCodes: string[] = [];
response.forEach((airport) => icaoCodes.push(airport.icao));
return icaoCodes;
const retval: AirportOverviewDto[] = [];
response.forEach((airport) =>
retval.push({
icao: airport.icao,
name: airport.name,
flightInformationRegion: airport.flightInformationRegion,
}),
);
return retval;
});
}

查看文件

@@ -15,6 +15,20 @@ export class AirportDto {
})
icao: string;
@IsNotEmpty()
@ApiProperty({
description: 'The name of the airport',
example: 'Berlin Brandenburg',
})
name: string;
@IsNotEmpty()
@ApiProperty({
description: 'The flight information region (FIR)',
example: 'FIR Bremen',
})
flightInformationRegion: string;
@IsNotEmpty()
@ApiProperty({
description: 'The airport location',

查看文件

@@ -0,0 +1,25 @@
import { IsNotEmpty } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class AirportOverviewDto {
@IsNotEmpty()
@ApiProperty({
description: 'The unique ICAO code',
example: 'EDDB',
})
icao: string;
@IsNotEmpty()
@ApiProperty({
description: 'The name of the airport',
example: 'Berlin Brandenburg',
})
name: string;
@IsNotEmpty()
@ApiProperty({
description: 'The flight information region (FIR)',
example: 'FIR Bremen',
})
flightInformationRegion: string;
}

查看文件

@@ -18,6 +18,18 @@ export class Airport {
})
icao: string;
@Prop({
required: true,
type: String,
})
name: string;
@Prop({
required: true,
type: String,
})
flightInformationRegion: string;
@Prop({
required: true,
type: Waypoint,