Various changes
This commit is contained in:
parent
a42591c701
commit
c388059f68
19 changed files with 1373 additions and 87 deletions
|
|
@ -8,7 +8,10 @@ use rustc_hash::FxHashMap;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use tracing::{info, warn};
|
||||
|
||||
use crate::consts::{DEFAULT_PROPERTIES_LIMIT, ENUM_NULL, H3_PRECOMPUTE_MAX, H3_REQUEST_MAX, H3_REQUEST_MIN, MAX_PROPERTIES_LIMIT};
|
||||
use crate::consts::{
|
||||
DEFAULT_PROPERTIES_LIMIT, ENUM_NULL, H3_PRECOMPUTE_MAX, H3_REQUEST_MAX, H3_REQUEST_MIN,
|
||||
MAX_PROPERTIES_LIMIT,
|
||||
};
|
||||
use crate::data::EnumFeatureData;
|
||||
use crate::filter::{parse_filters, row_passes_filters};
|
||||
use crate::state::AppState;
|
||||
|
|
@ -91,7 +94,10 @@ pub async fn get_hexagon_properties(
|
|||
) -> Result<Json<HexagonPropertiesResponse>, (StatusCode, String)> {
|
||||
let cell = h3o::CellIndex::from_str(¶ms.h3).map_err(|error| {
|
||||
warn!(h3 = %params.h3, error = %error, "Invalid H3 cell index");
|
||||
(StatusCode::BAD_REQUEST, format!("Invalid H3 cell: {}", error))
|
||||
(
|
||||
StatusCode::BAD_REQUEST,
|
||||
format!("Invalid H3 cell: {}", error),
|
||||
)
|
||||
})?;
|
||||
let cell_u64: u64 = cell.into();
|
||||
|
||||
|
|
@ -165,7 +171,10 @@ pub async fn get_hexagon_properties(
|
|||
});
|
||||
|
||||
let total = matching_rows.len();
|
||||
let limit = params.limit.unwrap_or(DEFAULT_PROPERTIES_LIMIT).min(MAX_PROPERTIES_LIMIT);
|
||||
let limit = params
|
||||
.limit
|
||||
.unwrap_or(DEFAULT_PROPERTIES_LIMIT)
|
||||
.min(MAX_PROPERTIES_LIMIT);
|
||||
let offset = params.offset.unwrap_or(0);
|
||||
let truncated = total > offset + limit;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue