Updated airport codes
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -72,6 +72,9 @@ pub struct Metars {
|
|||||||
|
|
||||||
impl Metars {
|
impl Metars {
|
||||||
pub async fn get_all(icaos: String) -> Result<Vec<Self>, CustomError> {
|
pub async fn get_all(icaos: String) -> Result<Vec<Self>, CustomError> {
|
||||||
|
if icaos.is_empty() {
|
||||||
|
return Ok(vec![]);
|
||||||
|
}
|
||||||
let station_icaos: Vec<&str> = icaos.split(',').collect();
|
let station_icaos: Vec<&str> = icaos.split(',').collect();
|
||||||
let mut conn = db::connection()?;
|
let mut conn = db::connection()?;
|
||||||
let db_metars: Vec<Metars> = match metars::table
|
let db_metars: Vec<Metars> = match metars::table
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { Airport } from './airport.types';
|
|||||||
import { Metar } from './metar.types';
|
import { Metar } from './metar.types';
|
||||||
|
|
||||||
export async function getMetars(airports: Airport[]): Promise<Metar[]> {
|
export async function getMetars(airports: Airport[]): Promise<Metar[]> {
|
||||||
|
if (airports.length == 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
const stationICAOs: string = airports.map((airport) => airport.icao).join(',');
|
const stationICAOs: string = airports.map((airport) => airport.icao).join(',');
|
||||||
const url = `http://localhost:5000/metars/${stationICAOs}`;
|
const url = `http://localhost:5000/metars/${stationICAOs}`;
|
||||||
const response = await axios.get(url).catch((error) => console.error(error));
|
const response = await axios.get(url).catch((error) => console.error(error));
|
||||||
|
|||||||
Reference in New Issue
Block a user