no more warnings + debug

This commit is contained in:
LinlyBoi
2023-12-17 23:57:26 +02:00
parent 341bb51fdb
commit 8edbc7e61d
2 changed files with 9 additions and 10 deletions

View File

@@ -4,14 +4,14 @@ pub fn init_arrivals_scope() -> actix_web::Scope {
let scope = web::scope("/arrivals").service(show_arrivals);
scope
}
use chrono::NaiveDateTime;
use chrono::NaiveTime;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Arrival {
a_id: u32,
time_of_day: NaiveDateTime,
week_day: u32,
tram_line: u32,
a_id: i32,
time_of_day: NaiveTime,
week_day: i32,
tram_line: i32,
direction: bool,
}
use web::Data;
@@ -19,11 +19,10 @@ use sqlx::{PgPool, query_as};
#[get("arrivals")]
async fn show_arrivals(db_pool: Data<PgPool>) -> impl Responder {
let arrivals = query_as!(Arrival, r#"SELECT * FROM arrivals"#)
.fetch_all(db_pool)
.fetch_all(db_pool.get_ref())
.await
.expect("Could not fetch arrivals");
HttpResponse::Ok()
.content_type("application/json")
.json(arrivals);
todo!()
.json(arrivals)
}