Merge pull request #257 from storytold/brandon-rename-weights-fields

rename singular "weights_*" fields to "weight_*"
This commit is contained in:
Brandon Thomas authored and GitHub committed 2023-12-29 12:07:33 -05:00
commit 1bf58b01e1
6 files changed
+22 -22

No files matched your search

@@ -89,7 +89,7 @@ pub struct UserBookmarkDetailsForUserList {
pub maybe_media_file_data: Option<MediaFileData>,
/// This is only populated if the item is a model weight.
pub maybe_weights_data: Option<WeightsData>,
pub maybe_weight_data: Option<WeightsData>,
}
#[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,
@@ -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()),
@@ -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,
@@ -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,
@@ -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,