new demo mode & tenure
Some checks failed
Build and publish Docker image / build-and-push (push) Successful in 8m43s
CI / Check (push) Failing after 8m49s

This commit is contained in:
Andras Schmelczer 2026-06-17 07:54:30 +01:00
parent 7656f24544
commit 4a0f00f2a4
64 changed files with 2875 additions and 338 deletions

View file

@ -11,7 +11,7 @@ use tracing::{info, warn};
use crate::auth::OptionalUser;
use crate::consts::PROPERTIES_LIMIT;
use crate::data::{HistoricalPrice, RenovationEvent};
use crate::data::{HistoricalPrice, RenovationEvent, TenureEvent};
use crate::licensing::{check_license_bounds, resolve_share_code};
use crate::parsing::{
cell_for_row_cached, h3_cell_bounds, needs_parent, parse_field_indices_with_poi,
@ -67,6 +67,9 @@ pub struct Property {
#[serde(skip_serializing_if = "Vec::is_empty")]
pub historical_prices: Vec<HistoricalPrice>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub tenure_history: Vec<TenureEvent>,
#[serde(flatten)]
pub features: FxHashMap<String, f32>,
}
@ -240,6 +243,7 @@ pub fn build_property(
lon: state.data.lon[row],
renovation_history: state.data.renovation_history(row).to_vec(),
historical_prices: state.data.historical_prices(row).to_vec(),
tenure_history: state.data.tenure_history(row).to_vec(),
property_sub_type: state.data.property_sub_type(row).map(String::from),
price_qualifier: state.data.price_qualifier(row).map(String::from),
former_council_house: lookup_enum_value(
@ -270,6 +274,7 @@ pub fn build_property(
pub async fn get_hexagon_properties(
State(shared): State<Arc<SharedState>>,
Extension(user): Extension<OptionalUser>,
Extension(geo): Extension<crate::demo_zone::DemoZone>,
Query(params): Query<HexagonPropertiesParams>,
) -> Result<Json<PropertyListResponse>, axum::response::Response> {
let state = shared.load_state();
@ -289,7 +294,7 @@ pub async fn get_hexagon_properties(
// License check using H3 cell bounds
let h3_bounds = h3_cell_bounds(cell, 0.0);
let share_bounds = resolve_share_code(&state, params.share.as_deref()).await;
check_license_bounds(&user.0, h3_bounds, share_bounds)?;
check_license_bounds(&user.0, h3_bounds, geo.free_zone, share_bounds)?;
let h3_str = params.h3;
let quant = state.data.quant_ref();