diff --git a/crates/service/storyteller_web/src/http_server/endpoints/stubs/app_plans.rs b/crates/service/storyteller_web/src/http_server/endpoints/stubs/app_plans.rs index 7b9164059b..9b578e6678 100644 --- a/crates/service/storyteller_web/src/http_server/endpoints/stubs/app_plans.rs +++ b/crates/service/storyteller_web/src/http_server/endpoints/stubs/app_plans.rs @@ -33,12 +33,14 @@ pub struct AppFeature { /// Optional. /// Whether the feature is enabled. /// If a feature is associated with a number rather than a boolean on/off, this will be absent. - pub is_enabled: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub is_enabled: Option, /// Optional. /// A quantity associated with the feature. /// Sometimes a feature may be associated with a number rather than an enabled flag, /// such as "number_of_models = 50". + #[serde(skip_serializing_if = "Option::is_none")] pub quantity: Option, } @@ -83,9 +85,6 @@ pub async fn get_app_plans_handler( http_request: HttpRequest, server_state: web::Data>) -> Result { - // TODO: Real features. - let username = ""; - let maybe_user = server_state .session_checker .maybe_get_user_session(&http_request, &server_state.mysql_pool) @@ -96,10 +95,12 @@ pub async fn get_app_plans_handler( })?; let unlimited_time = maybe_user + .as_ref() .map(|user| user.username.to_lowercase().starts_with("time")) .unwrap_or(false); let model_count = maybe_user + .as_ref() .map(|user| { let name = user.username.to_lowercase(); if name.ends_with("some") { @@ -120,15 +121,17 @@ pub async fn get_app_plans_handler( // NB: Triggered by username! if unlimited_time { features.push(AppFeature { - key: "no_time_limit", + key: "no_time_limit".to_string(), is_enabled: Some(true), + quantity: None, }); } // NB: Triggered by username! if model_count > 0 { features.push(AppFeature { - key: "number_of_downloads_supported", + key: "number_of_downloads_supported".to_string(), + is_enabled: None, quantity: Some(model_count), }); }