UNPKG

flight-planner

Version:
63 lines (62 loc) 2.66 kB
import { Aerodrome } from "../waypoint.types.js"; import { AerodromeRepository } from "../repositories/aerodrome.repository.js"; /** * AerodromeService class provides methods to manage and retrieve aerodrome data. * Acts as a service layer that handles business logic and validation. * * @class AerodromeService * @throws Error if the repository is not provided. */ declare class AerodromeService { private repository; /** * Creates a new instance of the AerodromeService class. * * @param repository - The aerodrome repository for data operations. * @throws Error if the repository is not provided. */ constructor(repository: AerodromeRepository); /** * Finds a single aerodrome by ICAO code. * * @param icao - The ICAO code to search for. * @returns A promise that resolves to an Aerodrome object. * @throws Error if the ICAO code is invalid or if no aerodrome is found. */ findOne(icao: string): Promise<Aerodrome>; /** * Finds multiple aerodromes by ICAO codes. * * @param icaoCodes - An array of ICAO codes to search for. * @returns A promise that resolves to an array of Aerodrome objects. * @throws Error if no valid ICAO codes are provided or if no aerodromes are found. */ findMany(icaoCodes: string[]): Promise<Aerodrome[]>; /** * Finds the nearest aerodrome to the given location. * * @param location - The geographical location to find the nearest aerodrome to. * @param radius - The search radius in kilometers (default is 100 km). * @param exclude - An optional array of ICAO codes to exclude from the search. * @returns A promise that resolves to the nearest aerodrome. * @throws Error if no aerodromes are found within the specified radius. */ nearest(location: GeoJSON.Position, radius?: number, exclude?: string[]): Promise<Aerodrome>; /** * Fetches data by geographic location within specified radius. * * @param location - The location coordinates [longitude, latitude]. * @param radius - The radius in kilometers (default: 100, max: 1000). * @returns A promise that resolves to an array of aerodromes. */ getByLocation(location: GeoJSON.Position, radius?: number): Promise<Aerodrome[]>; /** * Checks if an aerodrome exists. * * @param icaoCode - The ICAO code of the aerodrome to check. * @returns A promise that resolves to true if the aerodrome exists, false otherwise. * @throws Error if the ICAO code is invalid. */ exists(icaoCode: string): Promise<boolean>; } export default AerodromeService;