debug added idky
This commit is contained in:
@@ -6,7 +6,7 @@ pub fn init_arrivals_scope() -> actix_web::Scope {
|
||||
}
|
||||
use chrono::NaiveTime;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct Arrival {
|
||||
a_id: i32,
|
||||
time_of_day: NaiveTime,
|
||||
@@ -16,12 +16,13 @@ pub struct Arrival {
|
||||
}
|
||||
use web::Data;
|
||||
use sqlx::{PgPool, query_as};
|
||||
#[get("arrivals")]
|
||||
#[get("all")]
|
||||
async fn show_arrivals(db_pool: Data<PgPool>) -> impl Responder {
|
||||
let arrivals = query_as!(Arrival, r#"SELECT * FROM arrivals"#)
|
||||
.fetch_all(db_pool.get_ref())
|
||||
.await
|
||||
.expect("Could not fetch arrivals");
|
||||
dbg!(&arrivals);
|
||||
HttpResponse::Ok()
|
||||
.content_type("application/json")
|
||||
.json(arrivals)
|
||||
|
||||
Reference in New Issue
Block a user