24 lines
775 B
TypeScript
24 lines
775 B
TypeScript
|
|
import {ServiceBase} from "./serviceBase";
|
|
import {AirportModel} from "../models/airport.model";
|
|
|
|
export class AirportService extends ServiceBase {
|
|
static async getOne(icao : string) : Promise<AirportModel | null>{
|
|
const sql = `select icao, name, country, runwayLength from Airport where icao = ?1;`
|
|
const params = {
|
|
1: icao
|
|
}
|
|
return await this.get<AirportModel>(sql, params);
|
|
}
|
|
|
|
static async getAll() : Promise<AirportModel[]>{
|
|
const sql = `select icao, name, country, runwayLength from Airport;`
|
|
return await this.all<AirportModel>(sql);
|
|
|
|
}
|
|
|
|
static async getIcaoCodes() : Promise<string[]>{
|
|
const sql = `select icao from Airport;`
|
|
return await this.all<string>(sql);
|
|
}
|
|
} |