use actix_web::web::{scope, Data, ServiceConfig}; use actix_web::{get, HttpResponse}; pub fn mount(config: &mut ServiceConfig) { config.service(scope("/parking_spaces").service(all_parking_spaces)); } #[get("/all")] async fn all_parking_spaces(db: Data) -> HttpResponse { use oswilno_contract::parking_spaces; use sea_orm::prelude::*; let db = db.into_inner(); let spaces = parking_spaces::Entity::find().all(&*db).await.unwrap(); HttpResponse::Ok().json(spaces) }