From 8a02cbda5c3f16b26c1a91893db65db2dd3a44e5 Mon Sep 17 00:00:00 2001 From: Jules010209 <67187964+Jules010209@users.noreply.github.com> Date: Sun, 29 Jan 2023 21:34:40 +0100 Subject: [PATCH] Add files via upload --- src/airac.json | 6 ++++++ src/app.service.ts | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/airac.json b/src/airac.json index 2db711c..c0335f4 100644 --- a/src/airac.json +++ b/src/airac.json @@ -1,5 +1,11 @@ { "LFBD": { + "runways": { + "050": "05", + "230": "23", + "110": "11", + "290": "29" + }, "sid": { "05": { "CNA5Q": { diff --git a/src/app.service.ts b/src/app.service.ts index 72accdb..14fe8c2 100644 --- a/src/app.service.ts +++ b/src/app.service.ts @@ -8,17 +8,25 @@ const fbw_api = "https://api.flybywiresim.com"; @Injectable() export class AppService { - async atis(icao: any, res: any, req: any) { + async atis(icao: string, res: any, req: any) { // let metar_infos = await axios.get(`${fbw_api}/metar/${icao}?source=ms`).then(resp => resp.data); - return axios.get(`https://avwx.rest/api/metar/${icao}`, { + return axios.get(`https://avwx.rest/api/metar/${icao.toUpperCase()}`, { headers: { Authorization: `Bearer ${process.env.KEY}` } }).then((resp) => { - return res.send(JSON.parse(resp['data'])); + let data = JSON.parse(resp['data']); + let airport_departures = airac[icao.toUpperCase()].sid; + let airport_arivals = airac[icao.toUpperCase()].star; + + let airport_runways = airac[icao.toUpperCase()].runways; + + let wind = data?.wind_direction.value; + + return res.send(data); }); - // let result = metar_json.match("(?(?:^[a-zA-Z]..[a-zA-Z]))(?:_(?(?:$..)))?"); + // let result = metar_json.match("(?(?:^[a-zA-Z]..[a-zA-Z]))(?:_(?(?:$..)))?"); // airac[icao].sid['05'] }