Fixed metar route to use httpresponse

This commit is contained in:
2023-09-19 19:57:20 -04:00
parent 0d7797cdf0
commit c86d8743ec

View File

@@ -1,6 +1,6 @@
use crate::{error_handler::ServiceError, db::Metadata}; use crate::{error_handler::ServiceError, db::Metadata};
use crate::metars::Metar; use crate::metars::Metar;
use actix_web::{get, web, HttpResponse, Responder}; use actix_web::{get, web, HttpResponse};
use log::error; use log::error;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@@ -11,7 +11,7 @@ pub struct MetarsResponse {
} }
#[get("metars/{ids}")] #[get("metars/{ids}")]
async fn get_all(ids: web::Path<String>) -> impl Responder { async fn get_all(ids: web::Path<String>) -> HttpResponse {
let airports = match web::block(|| Ok::<_, ServiceError>(async {Metar::get_all(ids.into_inner()).await})) let airports = match web::block(|| Ok::<_, ServiceError>(async {Metar::get_all(ids.into_inner()).await}))
.await .await
.unwrap() .unwrap()