diff --git a/src/app/navdata/model.rs b/src/app/navdata/model.rs index 75c96d7..f101bb5 100644 --- a/src/app/navdata/model.rs +++ b/src/app/navdata/model.rs @@ -159,7 +159,7 @@ pub async fn get_navaid_by_id( pub async fn search_navaid( search: Option, - _page: Option, + page: Option, country: Option, navaid_type: Option, app_state: web::Data, @@ -194,7 +194,10 @@ pub async fn search_navaid( } query.push_str(" (icao_code LIKE '%' || ? || '%' OR name LIKE '%' || ? || '%' OR associated_airport LIKE '%' || ? || '%')"); } - query.push_str(" LIMIT 100"); + match page { + Some(page) => query.push_str(format!(" LIMIT {}, 100", page * 100).as_str()), + None => query.push_str(" LIMIT 100"), + }; // Build and fill the statement let mut statement = con.prepare(query)?; @@ -236,7 +239,7 @@ pub async fn search_navaid( pub async fn search_airport( search: Option, - _page: Option, + page: Option, country: Option, airport_type: Option, app_state: web::Data, @@ -272,7 +275,10 @@ pub async fn search_airport( } query.push_str(" (icao_code LIKE '%' || ? || '%' OR name LIKE '%' || ? || '%' OR municipality LIKE '%' || ? || '%' OR iata_code LIKE '%' || ? || '%')"); } - query.push_str(" LIMIT 100"); + match page { + Some(page) => query.push_str(format!(" LIMIT {}, 100", page * 100).as_str()), + None => query.push_str(" LIMIT 100"), + }; // Build and fill the statement let mut statement = con.prepare(query)?;