From 66594ce8f5f5a433c3833c7fde1caa10705d274b Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 29 Dec 2023 12:05:48 -0500 Subject: [PATCH] rename singular "weights_*" fields to "weight_*" --- .../list_user_bookmarks_for_user_handler.rs | 12 ++++++------ .../{upload_weight.rs => _unused_upload_weight.rs} | 0 .../src/http_server/endpoints/weights/get_weight.rs | 8 ++++---- .../endpoints/weights/list_available_weights.rs | 8 ++++---- .../endpoints/weights/list_featured_weights.rs | 8 ++++---- .../endpoints/weights/list_weights_by_user.rs | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) rename crates/service/web/storyteller_web/src/http_server/endpoints/weights/{upload_weight.rs => _unused_upload_weight.rs} (100%) diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/user_bookmarks/list_user_bookmarks_for_user_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/user_bookmarks/list_user_bookmarks_for_user_handler.rs index a73219b750..cb77766d72 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/user_bookmarks/list_user_bookmarks_for_user_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/user_bookmarks/list_user_bookmarks_for_user_handler.rs @@ -89,7 +89,7 @@ pub struct UserBookmarkDetailsForUserList { pub maybe_media_file_data: Option, /// This is only populated if the item is a model weight. - pub maybe_weights_data: Option, + pub maybe_weight_data: Option, } #[derive(Serialize, ToSchema)] @@ -103,8 +103,8 @@ pub struct MediaFileData { #[derive(Serialize, ToSchema)] pub struct WeightsData { pub title: String, - pub weights_type: WeightsType, - pub weights_category: WeightsCategory, + pub weight_type: WeightsType, + pub weight_category: WeightsCategory, /// Cover images are small descriptive images that can be set for any model. /// If a cover image is set, this is the path to the asset. @@ -221,12 +221,12 @@ pub async fn list_user_bookmarks_for_user_handler( public_bucket_path: path, }), }, - maybe_weights_data: match user_bookmark.entity_type { + maybe_weight_data: match user_bookmark.entity_type { UserBookmarkEntityType::ModelWeight => Some(WeightsData { // TODO(bt,2023-12-28): Proper default, optional, or "unknown" values would be better. title: user_bookmark.maybe_entity_descriptive_text.clone().unwrap_or_else(|| "weight".to_string()), - weights_type: user_bookmark.maybe_model_weight_type.unwrap_or(WeightsType::Tacotron2), - weights_category: user_bookmark.maybe_model_weight_category.unwrap_or(WeightsCategory::TextToSpeech), + weight_type: user_bookmark.maybe_model_weight_type.unwrap_or(WeightsType::Tacotron2), + weight_category: user_bookmark.maybe_model_weight_category.unwrap_or(WeightsCategory::TextToSpeech), maybe_cover_image_public_bucket_path: maybe_model_weight_cover_image, }), _ => None, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/upload_weight.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/_unused_upload_weight.rs similarity index 100% rename from crates/service/web/storyteller_web/src/http_server/endpoints/weights/upload_weight.rs rename to crates/service/web/storyteller_web/src/http_server/endpoints/weights/_unused_upload_weight.rs diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/get_weight.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/get_weight.rs index f22ad69253..9c312ed9a6 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/get_weight.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/get_weight.rs @@ -24,8 +24,8 @@ pub struct GetWeightResponse { success: bool, weight_token: ModelWeightToken, title: String, - weights_type: WeightsType, - weights_category: WeightsCategory, + weight_type: WeightsType, + weight_category: WeightsCategory, // TODO(bt,2023-12-24): Migrated the column. We should return nullables, but I don't want to break the frontend description_markdown: String, @@ -174,8 +174,8 @@ pub async fn get_weight_handler( success: true, weight_token: weight.token, title: weight.title, - weights_type: weight.weights_type, - weights_category: weight.weights_category, + weight_type: weight.weights_type, + weight_category: weight.weights_category, // TODO(bt,2023-12-24): Migrated the column. We should return nullable fields, but I don't want to break the frontend description_markdown: weight.maybe_description_markdown.unwrap_or_else(|| "".to_string()), description_rendered_html: weight.maybe_description_rendered_html.unwrap_or_else(|| "".to_string()), diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_available_weights.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_available_weights.rs index 7e26a4b7c9..8bb999e3f8 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_available_weights.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_available_weights.rs @@ -48,8 +48,8 @@ pub struct ListAvailableWeightsSuccessResponse { pub struct ModelWeightForList { pub weight_token: ModelWeightToken, - pub weights_type: WeightsType, - pub weights_category: WeightsCategory, + pub weight_type: WeightsType, + pub weight_category: WeightsCategory, pub title: String, @@ -254,8 +254,8 @@ pub async fn list_available_weights_handler( ModelWeightForList { weight_token: weight.token, title: weight.title, - weights_type: weight.weights_type, - weights_category: weight.weights_category, + weight_type: weight.weights_type, + weight_category: weight.weights_category, maybe_cover_image_public_bucket_path: maybe_cover_image, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_featured_weights.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_featured_weights.rs index 88a40b0a11..605f0cf06e 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_featured_weights.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_featured_weights.rs @@ -29,8 +29,8 @@ pub struct ListFeaturedWeightsSuccessResponse { pub struct ModelWeightForList { pub weight_token: ModelWeightToken, - pub weights_type: WeightsType, - pub weights_category: WeightsCategory, + pub weight_type: WeightsType, + pub weight_category: WeightsCategory, pub title: String, @@ -144,8 +144,8 @@ pub async fn list_featured_weights_handler( ModelWeightForList { weight_token: w.token, title: w.title, - weights_type: w.weights_type, - weights_category: w.weights_category, + weight_type: w.weights_type, + weight_category: w.weights_category, maybe_cover_image_public_bucket_path: maybe_cover_image, creator: UserDetailsLight::from_db_fields( &w.creator_user_token, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_weights_by_user.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_weights_by_user.rs index e92d4fd5c8..8ec0b1dd3a 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_weights_by_user.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_weights_by_user.rs @@ -23,8 +23,8 @@ use crate::server_state::ServerState; pub struct Weight { weight_token: ModelWeightToken, title: String, - weights_type: String, - weights_category: String, + weight_type: String, + weight_category: String, creator: UserDetailsLight, creator_set_visibility: Visibility, @@ -184,8 +184,8 @@ pub async fn list_weights_by_user_handler( Weight { weight_token: weight.token, title: weight.title, - weights_type: weight.weights_type.to_string(), - weights_category: weight.weights_category.to_string(), + weight_type: weight.weights_type.to_string(), + weight_category: weight.weights_category.to_string(), creator: UserDetailsLight::from_db_fields( &weight.creator_user_token, &weight.creator_username,