mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-02 07:45:41 -05:00
Compare commits
78
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12f59916b6 | ||
|
|
4489ffb95e | ||
|
|
733fb9bf53 | ||
|
|
79cbeaffe0 | ||
|
|
6aef6fa99e | ||
|
|
205ac37c3d | ||
|
|
cd02103457 | ||
|
|
46f184483f | ||
|
|
ecd1a12438 | ||
|
|
ad7b69030b | ||
|
|
cd583e3b91 | ||
|
|
291b4a2ff9 | ||
|
|
c4017370bf | ||
|
|
d120489daf | ||
|
|
0c1f4ff0e3 | ||
|
|
32df84a8ce | ||
|
|
2ea38f0ff4 | ||
|
|
993d60a746 | ||
|
|
e4ae6c0af2 | ||
|
|
88610b2c58 | ||
|
|
9d94737737 | ||
|
|
4cf4c3c5a2 | ||
|
|
3c1cba1fad | ||
|
|
1bf58b01e1 | ||
|
|
66594ce8f5 | ||
|
|
03bed40e57 | ||
|
|
ab7afcfb72 | ||
|
|
b331cc999c | ||
|
|
dbd91dd67f | ||
|
|
b0ed202c6a | ||
|
|
556454ce9c | ||
|
|
5d49f5c4e4 | ||
|
|
23daee1272 | ||
|
|
3deeaf8803 | ||
|
|
f0879a5241 | ||
|
|
5be341f5fc | ||
|
|
186622cedd | ||
|
|
1db9fd7a2a | ||
|
|
e5f21f26c8 | ||
|
|
a37dc7d498 | ||
|
|
b9b5051a99 | ||
|
|
e0f0a3dd92 | ||
|
|
adee3d577d | ||
|
|
97335b2233 | ||
|
|
779b171208 | ||
|
|
17e5641a00 | ||
|
|
afa91c032e | ||
|
|
a76807ab7d | ||
|
|
15c1cb8e5e | ||
|
|
4a69589f1d | ||
|
|
ed72cf7f7f | ||
|
|
ad093d3fa8 | ||
|
|
b505896864 | ||
|
|
b680002c6b | ||
|
|
40bb91f024 | ||
|
|
fa002d3fe3 | ||
|
|
02bec3655c | ||
|
|
12b7f4d25e | ||
|
|
02d6f6c940 | ||
|
|
f5d7c93c22 | ||
|
|
0125eba7cc | ||
|
|
033e42d1b1 | ||
|
|
aa0632bd41 | ||
|
|
87cc49982e | ||
|
|
853943f21a | ||
|
|
6f9dd4d6e3 | ||
|
|
5de56cd11b | ||
|
|
df16a4aa89 | ||
|
|
613289f1ab | ||
|
|
ae49b9da7d | ||
|
|
3f531ae9f0 | ||
|
|
370bcf3f2d | ||
|
|
685264e20c | ||
|
|
2c7400bf76 | ||
|
|
fae36d485b | ||
|
|
fe3107b1b0 | ||
|
|
bdde5da223 | ||
|
|
7539237ee4 |
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n\nON DUPLICATE KEY UPDATE\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 43
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "0a392b6adb884a4bb4c08fbc2123d40c27e9fbb5c2b688b182f849b0c1cc5735"
|
||||
}
|
||||
-212
@@ -1,212 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n f.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,\n f.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,\n f.entity_token,\n f.user_token as `user_token: tokens::tokens::users::UserToken`,\n u.username,\n u.display_name as user_display_name,\n u.email_gravatar_hash as user_gravatar_hash,\n f.created_at,\n f.updated_at,\n f.deleted_at,\n\n media_files.media_type as `maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n media_files.origin_product_category as `maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,\n\n model_weights.title as maybe_descriptive_text_model_weight_title,\n tts_models.title as maybe_descriptive_text_tts_model_title,\n tts_results.raw_inference_text as maybe_descriptive_text_tts_result_inference_text,\n users.display_name as maybe_descriptive_text_user_display_name,\n voice_conversion_models.title as maybe_descriptive_text_voice_conversion_model_title,\n zs_voices.title as maybe_descriptive_text_zs_voice_title\n\nFROM\n user_bookmarks AS f\nJOIN users AS u\n ON f.user_token = u.token\n\nLEFT OUTER JOIN model_weights ON model_weights.token = f.entity_token\nLEFT OUTER JOIN media_files ON media_files.token = f.entity_token\nLEFT OUTER JOIN tts_models ON tts_models.token = f.entity_token\nLEFT OUTER JOIN tts_results ON tts_results.token = f.entity_token\nLEFT OUTER JOIN users ON users.token = f.entity_token\nLEFT OUTER JOIN voice_conversion_models ON voice_conversion_models.token = f.entity_token\nLEFT OUTER JOIN zs_voices ON zs_voices.token = f.entity_token\n\nWHERE\n u.username = ?\n AND f.entity_type = ?\n AND f.deleted_at IS NULL\nORDER BY f.id DESC\nLIMIT 50\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::user_bookmarks::UserBookmarkToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "entity_token",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "user_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "user_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "MULTIPLE_KEY | BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "maybe_descriptive_text_model_weight_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "maybe_descriptive_text_tts_model_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "maybe_descriptive_text_tts_result_inference_text",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "maybe_descriptive_text_user_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"name": "maybe_descriptive_text_voice_conversion_model_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"name": "maybe_descriptive_text_zs_voice_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 2
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "3a7ac7f979ac270dad1070031d0d663d0eb3d969365f6b2fd048ca41c5c455b2"
|
||||
}
|
||||
+267
@@ -0,0 +1,267 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n m.token as `token: tokens::tokens::media_files::MediaFileToken`,\n\n m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n\n users.token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,\n users.username as maybe_creator_username,\n users.display_name as maybe_creator_display_name,\n users.email_gravatar_hash as maybe_creator_gravatar_hash,\n\n m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n model_weights.token as `maybe_model_weights_token: tokens::tokens::model_weights::ModelWeightToken`,\n model_weights.title as maybe_model_weights_title,\n model_weights.weights_type as `maybe_model_weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n model_weights.weights_category as `maybe_model_weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n\n cover_image.public_bucket_directory_hash as maybe_model_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_model_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_model_cover_image_public_bucket_extension,\n\n model_weight_creator.token as `maybe_model_weight_creator_user_token: tokens::tokens::users::UserToken`,\n model_weight_creator.username as maybe_model_weight_creator_username,\n model_weight_creator.display_name as maybe_model_weight_creator_display_name,\n model_weight_creator.email_gravatar_hash as maybe_model_weight_creator_gravatar_hash,\n\n m.public_bucket_directory_hash,\n m.maybe_public_bucket_prefix,\n m.maybe_public_bucket_extension,\n\n m.created_at,\n m.updated_at\n\nFROM media_files AS m\nLEFT OUTER JOIN users\n ON m.maybe_creator_user_token = users.token\nLEFT OUTER JOIN model_weights\n ON m.maybe_origin_model_token = model_weights.token\nLEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = model_weights.maybe_cover_image_media_file_token\nLEFT OUTER JOIN users as model_weight_creator\n ON model_weight_creator.token = model_weights.creator_user_token\nWHERE\n m.token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::media_files::MediaFileToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "media_type: enums::by_table::media_files::media_file_type::MediaFileType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "maybe_creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "maybe_creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "maybe_creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "maybe_model_weights_token: tokens::tokens::model_weights::ModelWeightToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "maybe_model_weights_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "maybe_model_weights_type: enums::by_table::model_weights::weights_types::WeightsType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "maybe_model_weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "maybe_model_cover_image_public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "maybe_model_cover_image_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "maybe_model_cover_image_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "maybe_model_weight_creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "maybe_model_weight_creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"name": "maybe_model_weight_creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"name": "maybe_model_weight_creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 18,
|
||||
"name": "public_bucket_directory_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 19,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 20,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 22,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "5126434fe542604233d8c8a4f553998d8e71b4957989a9a856ebaf7fb52bab42"
|
||||
}
|
||||
+267
@@ -0,0 +1,267 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n m.token as `token: tokens::tokens::media_files::MediaFileToken`,\n\n m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n\n users.token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,\n users.username as maybe_creator_username,\n users.display_name as maybe_creator_display_name,\n users.email_gravatar_hash as maybe_creator_gravatar_hash,\n\n m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n model_weights.token as `maybe_model_weights_token: tokens::tokens::model_weights::ModelWeightToken`,\n model_weights.title as maybe_model_weights_title,\n model_weights.weights_type as `maybe_model_weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n model_weights.weights_category as `maybe_model_weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n\n cover_image.public_bucket_directory_hash as maybe_model_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_model_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_model_cover_image_public_bucket_extension,\n\n model_weight_creator.token as `maybe_model_weight_creator_user_token: tokens::tokens::users::UserToken`,\n model_weight_creator.username as maybe_model_weight_creator_username,\n model_weight_creator.display_name as maybe_model_weight_creator_display_name,\n model_weight_creator.email_gravatar_hash as maybe_model_weight_creator_gravatar_hash,\n\n m.public_bucket_directory_hash,\n m.maybe_public_bucket_prefix,\n m.maybe_public_bucket_extension,\n\n m.created_at,\n m.updated_at\n\nFROM media_files AS m\nLEFT OUTER JOIN users\n ON m.maybe_creator_user_token = users.token\nLEFT OUTER JOIN model_weights\n ON m.maybe_origin_model_token = model_weights.token\nLEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = model_weights.maybe_cover_image_media_file_token\nLEFT OUTER JOIN users as model_weight_creator\n ON model_weight_creator.token = model_weights.creator_user_token\nWHERE\n m.token = ?\n AND m.user_deleted_at IS NULL\n AND m.mod_deleted_at IS NULL\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::media_files::MediaFileToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "media_type: enums::by_table::media_files::media_file_type::MediaFileType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "maybe_creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "maybe_creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "maybe_creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "maybe_model_weights_token: tokens::tokens::model_weights::ModelWeightToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "maybe_model_weights_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "maybe_model_weights_type: enums::by_table::model_weights::weights_types::WeightsType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "maybe_model_weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "maybe_model_cover_image_public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "maybe_model_cover_image_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "maybe_model_cover_image_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "maybe_model_weight_creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "maybe_model_weight_creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"name": "maybe_model_weight_creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"name": "maybe_model_weight_creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 18,
|
||||
"name": "public_bucket_directory_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 19,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 20,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 22,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "58648783cb376fc7ad093ff50a8a7bcb3c55fe57b2ad7d3ebbbdbc63573069ba"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = NULL,\n maybe_description_rendered_html = NULL,\n\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 15
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "6512f05410514927b52b8cc42f4eda0ad7a256254fd7fcf3b8a1cc429b06ad38"
|
||||
}
|
||||
-212
@@ -1,212 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n f.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,\n f.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,\n f.entity_token,\n f.user_token as `user_token: tokens::tokens::users::UserToken`,\n u.username,\n u.display_name as user_display_name,\n u.email_gravatar_hash as user_gravatar_hash,\n f.created_at,\n f.updated_at,\n f.deleted_at,\n\n media_files.media_type as `maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n media_files.origin_product_category as `maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,\n\n model_weights.title as maybe_descriptive_text_model_weight_title,\n tts_models.title as maybe_descriptive_text_tts_model_title,\n tts_results.raw_inference_text as maybe_descriptive_text_tts_result_inference_text,\n users.display_name as maybe_descriptive_text_user_display_name,\n voice_conversion_models.title as maybe_descriptive_text_voice_conversion_model_title,\n zs_voices.title as maybe_descriptive_text_zs_voice_title\n\nFROM\n user_bookmarks AS f\nJOIN users AS u\n ON f.user_token = u.token\n\nLEFT OUTER JOIN model_weights ON model_weights.token = f.entity_token\nLEFT OUTER JOIN media_files ON media_files.token = f.entity_token\nLEFT OUTER JOIN tts_models ON tts_models.token = f.entity_token\nLEFT OUTER JOIN tts_results ON tts_results.token = f.entity_token\nLEFT OUTER JOIN users ON users.token = f.entity_token\nLEFT OUTER JOIN voice_conversion_models ON voice_conversion_models.token = f.entity_token\nLEFT OUTER JOIN zs_voices ON zs_voices.token = f.entity_token\n\nWHERE\n u.username = ?\n AND f.deleted_at IS NULL\nORDER BY f.id DESC\nLIMIT 50\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::user_bookmarks::UserBookmarkToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "entity_token",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "user_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "user_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "MULTIPLE_KEY | BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "MULTIPLE_KEY | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "maybe_descriptive_text_model_weight_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "maybe_descriptive_text_tts_model_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "maybe_descriptive_text_tts_result_inference_text",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "maybe_descriptive_text_user_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"name": "maybe_descriptive_text_voice_conversion_model_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"name": "maybe_descriptive_text_zs_voice_title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "707af35ee4ab4519f28e6d69982944666e6c7c0f24b5da79dde828ffdb2c8302"
|
||||
}
|
||||
+44
-55
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_thumbnail_token,\n wt.description_markdown,\n wt.description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n avatar.public_bucket_directory_hash as maybe_avatar_public_bucket_hash,\n avatar.maybe_public_bucket_prefix as maybe_avatar_public_bucket_prefix,\n avatar.maybe_public_bucket_extension as maybe_avatar_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as avatar\n ON avatar.token = wt.maybe_avatar_media_file_token\n WHERE\n wt.token = ?\n ",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -45,36 +45,26 @@
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_thumbnail_token",
|
||||
"name": "maybe_description_markdown",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"type": "Blob",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description_markdown",
|
||||
"name": "maybe_description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -84,7 +74,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"ordinal": 7,
|
||||
"name": "creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -94,7 +84,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"ordinal": 8,
|
||||
"name": "creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -104,7 +94,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"ordinal": 9,
|
||||
"name": "creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
@@ -114,7 +104,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"ordinal": 10,
|
||||
"name": "creator_ip_address",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -124,7 +114,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"ordinal": 11,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
@@ -134,7 +124,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"ordinal": 12,
|
||||
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -144,7 +134,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"ordinal": 13,
|
||||
"name": "original_download_url",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -154,7 +144,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"ordinal": 14,
|
||||
"name": "original_filename",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -164,7 +154,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"ordinal": 15,
|
||||
"name": "file_size_bytes",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -174,7 +164,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"ordinal": 16,
|
||||
"name": "file_checksum_sha2",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
@@ -184,7 +174,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 18,
|
||||
"ordinal": 17,
|
||||
"name": "public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -194,7 +184,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 19,
|
||||
"ordinal": 18,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -204,7 +194,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 20,
|
||||
"ordinal": 19,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -214,8 +204,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "maybe_avatar_public_bucket_hash",
|
||||
"ordinal": 20,
|
||||
"name": "maybe_cover_image_public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
@@ -223,9 +213,19 @@
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "maybe_cover_image_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 22,
|
||||
"name": "maybe_avatar_public_bucket_prefix",
|
||||
"name": "maybe_cover_image_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
@@ -235,16 +235,6 @@
|
||||
},
|
||||
{
|
||||
"ordinal": 23,
|
||||
"name": "maybe_avatar_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 24,
|
||||
"name": "cached_user_ratings_negative_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -254,7 +244,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 25,
|
||||
"ordinal": 24,
|
||||
"name": "cached_user_ratings_positive_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -264,7 +254,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 26,
|
||||
"ordinal": 25,
|
||||
"name": "cached_user_ratings_total_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -274,7 +264,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 27,
|
||||
"ordinal": 26,
|
||||
"name": "maybe_cached_user_ratings_ratio",
|
||||
"type_info": {
|
||||
"type": "Float",
|
||||
@@ -284,7 +274,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 28,
|
||||
"ordinal": 27,
|
||||
"name": "cached_user_ratings_last_updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -294,7 +284,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 29,
|
||||
"ordinal": 28,
|
||||
"name": "version",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -304,7 +294,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 30,
|
||||
"ordinal": 29,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -314,7 +304,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 31,
|
||||
"ordinal": 30,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -324,7 +314,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 32,
|
||||
"ordinal": 31,
|
||||
"name": "user_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -334,7 +324,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 33,
|
||||
"ordinal": 32,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -353,8 +343,7 @@
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
@@ -384,5 +373,5 @@
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "4e30e34cdf7a5834a3981d5e634506966bac9f9c420e800d15ce313778272cee"
|
||||
"hash": "7d3806f46b5cc96c0e3df22454190834c0294ad34db2d8271f2e2863a3cca3a1"
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n UPDATE model_weights\n SET\n title = COALESCE(?, title),\n description_markdown = COALESCE(?, description_markdown),\n maybe_thumbnail_token = COALESCE(?, maybe_thumbnail_token),\n description_rendered_html = COALESCE(?, description_rendered_html),\n creator_set_visibility = COALESCE(?, creator_set_visibility),\n version = version + 1\n WHERE token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 6
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "81df77a84fee48398e8a07e053b0393a0e341caf652c18c7160dd0a59247a19a"
|
||||
}
|
||||
-355
@@ -1,355 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n SELECT\n mw.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n mw.title,\n mw.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n mw.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n mw.maybe_thumbnail_token,\n mw.description_markdown,\n mw.description_rendered_html,\n users.token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash as creator_email_gravatar_hash,\n mw.creator_ip_address,\n mw.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n mw.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n mw.original_download_url,\n mw.original_filename,\n mw.file_size_bytes,\n mw.file_checksum_sha2,\n mw.public_bucket_hash,\n mw.maybe_public_bucket_prefix,\n mw.maybe_public_bucket_extension,\n mw.cached_user_ratings_negative_count,\n mw.cached_user_ratings_positive_count,\n mw.cached_user_ratings_total_count,\n mw.maybe_cached_user_ratings_ratio,\n mw.cached_user_ratings_last_updated_at,\n mw.version,\n mw.created_at,\n mw.updated_at,\n mw.user_deleted_at,\n mw.mod_deleted_at\n FROM model_weights as mw\n JOIN users\n ON users.token = mw.creator_user_token\n WHERE\n users.username = ?\n AND mw.user_deleted_at IS NULL\n AND mw.mod_deleted_at IS NULL\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_thumbnail_token",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description_markdown",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "creator_email_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "creator_ip_address",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 160
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "original_download_url",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 2048
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "original_filename",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"name": "file_size_bytes",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"name": "file_checksum_sha2",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 18,
|
||||
"name": "public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 19,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 20,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "cached_user_ratings_negative_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 22,
|
||||
"name": "cached_user_ratings_positive_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 23,
|
||||
"name": "cached_user_ratings_total_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 24,
|
||||
"name": "maybe_cached_user_ratings_ratio",
|
||||
"type_info": {
|
||||
"type": "Float",
|
||||
"flags": "",
|
||||
"char_set": 63,
|
||||
"max_size": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 25,
|
||||
"name": "cached_user_ratings_last_updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 26,
|
||||
"name": "version",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 27,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 28,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 29,
|
||||
"name": "user_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 30,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "854da1bad28fbcf5a8f82c26c52c25a7727957b52b727831ce62518b3c5fc9bd"
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n\n maybe_thumbnail_token = NULL,\n maybe_avatar_media_file_token = NULL,\n maybe_cover_media_file_token = NULL,\n description_markdown = NULL,\n description_rendered_html = NULL,\n\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 15
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "8cb3ba5acb8dbef84408370810c98d4b99223761d4547ce7c8a9438ba92e8523"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n INSERT INTO model_weights\n SET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = ?,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = ?,\n cached_user_ratings_positive_count = ?,\n cached_user_ratings_negative_count = ?,\n maybe_cached_user_ratings_ratio = ?,\n version = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 22
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "a18c5b1418d71fa9aefd3ae5c440be2afc1f9467808aa66d3b850a4d54c81e4d"
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_thumbnail_token = NULL,\n maybe_avatar_media_file_token = NULL,\n maybe_cover_media_file_token = NULL,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n\nON DUPLICATE KEY UPDATE\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_thumbnail_token = NULL,\n maybe_avatar_media_file_token = NULL,\n maybe_cover_media_file_token = NULL,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 43
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "aae28dc5fbeff858e4c9dd8b079752ce7892d76b56d2eff95db39c6b6d9f7f11"
|
||||
}
|
||||
-146
@@ -1,146 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n m.token as `token: tokens::tokens::media_files::MediaFileToken`,\n\n m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n\n users.token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,\n users.username as maybe_creator_username,\n users.display_name as maybe_creator_display_name,\n users.email_gravatar_hash as maybe_creator_gravatar_hash,\n\n m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n m.public_bucket_directory_hash,\n m.maybe_public_bucket_prefix,\n m.maybe_public_bucket_extension,\n\n m.created_at,\n m.updated_at\n\nFROM media_files AS m\nLEFT OUTER JOIN users\n ON m.maybe_creator_user_token = users.token\nWHERE\n m.token = ?\n AND m.user_deleted_at IS NULL\n AND m.mod_deleted_at IS NULL\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::media_files::MediaFileToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "media_type: enums::by_table::media_files::media_file_type::MediaFileType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "maybe_creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "maybe_creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "maybe_creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "public_bucket_directory_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "afdbb01a3efc9bcf283d0c8888995673b9f50588788a44f004d3ae4f330092ef"
|
||||
}
|
||||
+44
-55
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_thumbnail_token,\n wt.description_markdown,\n wt.description_rendered_html,\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n avatar.public_bucket_directory_hash as maybe_avatar_public_bucket_hash,\n avatar.maybe_public_bucket_prefix as maybe_avatar_public_bucket_prefix,\n avatar.maybe_public_bucket_extension as maybe_avatar_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as avatar\n ON avatar.token = wt.maybe_avatar_media_file_token\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ",
|
||||
"query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -45,36 +45,26 @@
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_thumbnail_token",
|
||||
"name": "maybe_description_markdown",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"type": "Blob",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description_markdown",
|
||||
"name": "maybe_description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"flags": "BLOB | BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "creator_ip_address",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -84,7 +74,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"ordinal": 7,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
@@ -94,7 +84,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"ordinal": 8,
|
||||
"name": "creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -104,7 +94,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"ordinal": 9,
|
||||
"name": "creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -114,7 +104,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"ordinal": 10,
|
||||
"name": "creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -124,7 +114,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"ordinal": 11,
|
||||
"name": "creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
@@ -134,7 +124,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"ordinal": 12,
|
||||
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -144,7 +134,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"ordinal": 13,
|
||||
"name": "original_download_url",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -154,7 +144,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"ordinal": 14,
|
||||
"name": "original_filename",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -164,7 +154,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"ordinal": 15,
|
||||
"name": "file_size_bytes",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -174,7 +164,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"ordinal": 16,
|
||||
"name": "file_checksum_sha2",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
@@ -184,7 +174,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 18,
|
||||
"ordinal": 17,
|
||||
"name": "public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -194,7 +184,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 19,
|
||||
"ordinal": 18,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -204,7 +194,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 20,
|
||||
"ordinal": 19,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
@@ -214,8 +204,8 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "maybe_avatar_public_bucket_hash",
|
||||
"ordinal": 20,
|
||||
"name": "maybe_cover_image_public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
@@ -223,9 +213,19 @@
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "maybe_cover_image_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 22,
|
||||
"name": "maybe_avatar_public_bucket_prefix",
|
||||
"name": "maybe_cover_image_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
@@ -235,16 +235,6 @@
|
||||
},
|
||||
{
|
||||
"ordinal": 23,
|
||||
"name": "maybe_avatar_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 24,
|
||||
"name": "cached_user_ratings_negative_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -254,7 +244,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 25,
|
||||
"ordinal": 24,
|
||||
"name": "cached_user_ratings_positive_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -264,7 +254,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 26,
|
||||
"ordinal": 25,
|
||||
"name": "cached_user_ratings_total_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -274,7 +264,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 27,
|
||||
"ordinal": 26,
|
||||
"name": "maybe_cached_user_ratings_ratio",
|
||||
"type_info": {
|
||||
"type": "Float",
|
||||
@@ -284,7 +274,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 28,
|
||||
"ordinal": 27,
|
||||
"name": "cached_user_ratings_last_updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -294,7 +284,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 29,
|
||||
"ordinal": 28,
|
||||
"name": "version",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
@@ -304,7 +294,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 30,
|
||||
"ordinal": 29,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -314,7 +304,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 31,
|
||||
"ordinal": 30,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -324,7 +314,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 32,
|
||||
"ordinal": 31,
|
||||
"name": "user_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -334,7 +324,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 33,
|
||||
"ordinal": 32,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
@@ -353,8 +343,7 @@
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
@@ -384,5 +373,5 @@
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "93084dc42ae4ada186dc90bdd470122342586f4f19a3ac961286c1c54a5c32b2"
|
||||
"hash": "bb2c5a81ab6f38ecef7ee177a4ea36e75c5d2180a897094f940f097bbbd66060"
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n INSERT INTO model_weights\n SET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_thumbnail_token = ?,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = ?,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = ?,\n cached_user_ratings_positive_count = ?,\n cached_user_ratings_negative_count = ?,\n maybe_cached_user_ratings_ratio = ?,\n version = ?\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 23
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "cb07f1522d0d619e2f364af78250080c99e7930ec095c5600abb80a9d8c5154d"
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n UPDATE model_weights\n SET\n maybe_avatar_media_file_token = ?\n WHERE token = ?\n LIMIT 1\n ",
|
||||
"query": "\n UPDATE model_weights\n SET\n maybe_cover_image_media_file_token = ?\n WHERE token = ?\n LIMIT 1\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
@@ -8,5 +8,5 @@
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "bda002b24b98328f0fb0440cfc82a47faf01e5d16d1030e15a7e2da161dd0d80"
|
||||
"hash": "d7b28a5b4f0220b02eacb01df030c4d971fd191cf3cb5f0211ce29604d36bca3"
|
||||
}
|
||||
-146
@@ -1,146 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\nSELECT\n m.token as `token: tokens::tokens::media_files::MediaFileToken`,\n\n m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,\n\n users.token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,\n users.username as maybe_creator_username,\n users.display_name as maybe_creator_display_name,\n users.email_gravatar_hash as maybe_creator_gravatar_hash,\n\n m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n m.public_bucket_directory_hash,\n m.maybe_public_bucket_prefix,\n m.maybe_public_bucket_extension,\n\n m.created_at,\n m.updated_at\n\nFROM media_files AS m\nLEFT OUTER JOIN users\n ON m.maybe_creator_user_token = users.token\nWHERE\n m.token = ?\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::media_files::MediaFileToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "media_type: enums::by_table::media_files::media_file_type::MediaFileType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "maybe_creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "maybe_creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "maybe_creator_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "public_bucket_directory_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "dcc8de321d68f8d54f5978b17cec7247013142fa26ac360016e849e88cf844ad"
|
||||
}
|
||||
-355
@@ -1,355 +0,0 @@
|
||||
{
|
||||
"db_name": "MySQL",
|
||||
"query": "\n SELECT \n mw.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n mw.title,\n mw.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n mw.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n mw.maybe_thumbnail_token,\n mw.description_markdown,\n mw.description_rendered_html,\n users.token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash as creator_email_gravatar_hash,\n mw.creator_ip_address,\n mw.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n mw.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n mw.original_download_url,\n mw.original_filename,\n mw.file_size_bytes,\n mw.file_checksum_sha2,\n mw.public_bucket_hash,\n mw.maybe_public_bucket_prefix,\n mw.maybe_public_bucket_extension,\n mw.cached_user_ratings_negative_count,\n mw.cached_user_ratings_positive_count,\n mw.cached_user_ratings_total_count,\n mw.maybe_cached_user_ratings_ratio,\n mw.cached_user_ratings_last_updated_at,\n mw.version,\n mw.created_at,\n mw.updated_at,\n mw.user_deleted_at,\n mw.mod_deleted_at\n FROM model_weights as mw\n JOIN users\n ON users.token = mw.creator_user_token\n WHERE\n users.username = ?\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "token: tokens::tokens::model_weights::ModelWeightToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "title",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "weights_type: enums::by_table::model_weights::weights_types::WeightsType",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "weights_category: enums::by_table::model_weights::weights_category::WeightsCategory",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "maybe_thumbnail_token",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 5,
|
||||
"name": "description_markdown",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 6,
|
||||
"name": "description_rendered_html",
|
||||
"type_info": {
|
||||
"type": "Blob",
|
||||
"flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 262140
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 7,
|
||||
"name": "creator_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 8,
|
||||
"name": "creator_username",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 9,
|
||||
"name": "creator_display_name",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 10,
|
||||
"name": "creator_email_gravatar_hash",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 11,
|
||||
"name": "creator_ip_address",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 160
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 12,
|
||||
"name": "creator_set_visibility: enums::common::visibility::Visibility",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | ENUM",
|
||||
"char_set": 224,
|
||||
"max_size": 28
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 13,
|
||||
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 14,
|
||||
"name": "original_download_url",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 2048
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 15,
|
||||
"name": "original_filename",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 1020
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 16,
|
||||
"name": "file_size_bytes",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 17,
|
||||
"name": "file_checksum_sha2",
|
||||
"type_info": {
|
||||
"type": "String",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 256
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 18,
|
||||
"name": "public_bucket_hash",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
|
||||
"char_set": 224,
|
||||
"max_size": 128
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 19,
|
||||
"name": "maybe_public_bucket_prefix",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 20,
|
||||
"name": "maybe_public_bucket_extension",
|
||||
"type_info": {
|
||||
"type": "VarString",
|
||||
"flags": "BINARY",
|
||||
"char_set": 224,
|
||||
"max_size": 64
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 21,
|
||||
"name": "cached_user_ratings_negative_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 22,
|
||||
"name": "cached_user_ratings_positive_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 23,
|
||||
"name": "cached_user_ratings_total_count",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL | UNSIGNED",
|
||||
"char_set": 63,
|
||||
"max_size": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 24,
|
||||
"name": "maybe_cached_user_ratings_ratio",
|
||||
"type_info": {
|
||||
"type": "Float",
|
||||
"flags": "",
|
||||
"char_set": 63,
|
||||
"max_size": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 25,
|
||||
"name": "cached_user_ratings_last_updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 26,
|
||||
"name": "version",
|
||||
"type_info": {
|
||||
"type": "Long",
|
||||
"flags": "NOT_NULL",
|
||||
"char_set": 63,
|
||||
"max_size": 11
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 27,
|
||||
"name": "created_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 28,
|
||||
"name": "updated_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "NOT_NULL | BINARY | TIMESTAMP | ON_UPDATE_NOW",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 29,
|
||||
"name": "user_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"ordinal": 30,
|
||||
"name": "mod_deleted_at",
|
||||
"type_info": {
|
||||
"type": "Timestamp",
|
||||
"flags": "BINARY",
|
||||
"char_set": 63,
|
||||
"max_size": 19
|
||||
}
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "ec733ae6705dc03fb785e2299c35fcfef23422142735319c8cd091ca8179f97d"
|
||||
}
|
||||
Generated
+106
-3
@@ -301,6 +301,55 @@ dependencies = [
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix-web-lab"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6ddd78b365b70614e27f49a128ab8edba32bbc8f9b2abb1fbe07f15dd48cfab"
|
||||
dependencies = [
|
||||
"actix-http",
|
||||
"actix-router",
|
||||
"actix-service",
|
||||
"actix-utils",
|
||||
"actix-web",
|
||||
"actix-web-lab-derive",
|
||||
"ahash 0.8.6",
|
||||
"arc-swap",
|
||||
"async-trait",
|
||||
"bytes 1.5.0",
|
||||
"bytestring",
|
||||
"csv",
|
||||
"derive_more",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"http",
|
||||
"impl-more",
|
||||
"itertools 0.11.0",
|
||||
"local-channel",
|
||||
"mediatype",
|
||||
"mime",
|
||||
"once_cell",
|
||||
"pin-project-lite",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_html_form",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix-web-lab-derive"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9aa0b287c8de4a76b691f29dbb5451e8dd5b79d777eaf87350c9b0cbfdb5e968"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix_derive"
|
||||
version = "0.6.1"
|
||||
@@ -543,6 +592,12 @@ version = "1.0.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
|
||||
|
||||
[[package]]
|
||||
name = "archives"
|
||||
version = "0.0.1"
|
||||
@@ -1464,6 +1519,27 @@ dependencies = [
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "csv"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe"
|
||||
dependencies = [
|
||||
"csv-core",
|
||||
"itoa 1.0.9",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "csv-core"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.13.4"
|
||||
@@ -1914,6 +1990,7 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sqlx",
|
||||
"storyteller_root",
|
||||
"subprocess",
|
||||
"subprocess_common",
|
||||
"tempdir",
|
||||
@@ -2921,6 +2998,12 @@ dependencies = [
|
||||
"testing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "impl-more"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.1.0"
|
||||
@@ -2949,9 +3032,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "infer"
|
||||
version = "0.11.0"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a6c16b11a665b26aeeb9b1d7f954cdeb034be38dd00adab4f2ae921a8fee804"
|
||||
checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199"
|
||||
dependencies = [
|
||||
"cfb 0.7.3",
|
||||
]
|
||||
@@ -3459,6 +3542,12 @@ dependencies = [
|
||||
"symphonia",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mediatype"
|
||||
version = "0.19.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf0bc9784973713e4a90d515a4302991ca125a7c4516951cb607f2298cb757e5"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.6.4"
|
||||
@@ -3564,7 +3653,7 @@ dependencies = [
|
||||
name = "mimetypes"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"infer 0.11.0",
|
||||
"infer 0.15.0",
|
||||
"my-workspace-hack",
|
||||
]
|
||||
|
||||
@@ -5272,6 +5361,19 @@ dependencies = [
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_html_form"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224e6a14f315852940f3ec103125aa6482f0e224732ed91ed3330ed633077c34"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"indexmap",
|
||||
"itoa 1.0.9",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.108"
|
||||
@@ -5892,6 +5994,7 @@ dependencies = [
|
||||
"actix-service",
|
||||
"actix-utils",
|
||||
"actix-web",
|
||||
"actix-web-lab",
|
||||
"actix_helpers",
|
||||
"anyhow",
|
||||
"async-stripe",
|
||||
|
||||
@@ -40,7 +40,9 @@ deny = [
|
||||
"clippy::redundant_static_lifetimes", # Lint: feels more modern to elide static lifetimes
|
||||
|
||||
# Rust
|
||||
"unused_parens", # Unused parens are ugly
|
||||
"unused_imports", # These are easy to automatically cull
|
||||
"unused_variables", # Don't leave cruft
|
||||
|
||||
# Possible:
|
||||
# "clippy::ptr_arg",
|
||||
|
||||
@@ -8,14 +8,14 @@ select
|
||||
id,
|
||||
token,
|
||||
download_type,
|
||||
title,
|
||||
download_url,
|
||||
SUBSTRING(title, 1, 35) as title,
|
||||
SUBSTRING(download_url, 1, 100) as title,
|
||||
status,
|
||||
attempt_count
|
||||
from generic_download_jobs
|
||||
where status IN ('started', 'attempt_failed', 'complete_failure', 'dead')
|
||||
and download_type NOT IN ('vits', 'hifigan')
|
||||
and created_at > NOW() - INTERVAL 15 DAY;
|
||||
and created_at > NOW() - INTERVAL 30 DAY;
|
||||
|
||||
|
||||
-- 2) Then restart them
|
||||
@@ -32,7 +32,7 @@ where token IN (
|
||||
from generic_download_jobs
|
||||
where status IN ('started', 'attempt_failed', 'complete_failure', 'dead')
|
||||
and download_type NOT IN ('vits', 'hifigan')
|
||||
and created_at > NOW() - INTERVAL 15 DAY
|
||||
and created_at > NOW() - INTERVAL 30 DAY
|
||||
) as x
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
select
|
||||
distinct download_type,
|
||||
count(*) as created
|
||||
from generic_download_jobs
|
||||
where created_at > (CURDATE() - INTERVAL 60 DAY)
|
||||
group by download_type;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
RENAME COLUMN maybe_cover_image_media_file_token TO maybe_cover_media_file_token;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
RENAME COLUMN maybe_cover_media_file_token TO maybe_cover_image_media_file_token;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
ADD COLUMN maybe_thumbnail_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER title;
|
||||
|
||||
ALTER TABLE model_weights
|
||||
ADD COLUMN maybe_avatar_media_file_token VARCHAR(32) DEFAULT NULL
|
||||
AFTER maybe_thumbnail_token;
|
||||
|
||||
CREATE INDEX fk_maybe_avatar_media_file_token ON model_weights (maybe_avatar_media_file_token);
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Drop column
|
||||
ALTER TABLE model_weights DROP COLUMN maybe_thumbnail_token;
|
||||
ALTER TABLE model_weights DROP COLUMN maybe_avatar_media_file_token;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
CHANGE maybe_description_markdown description_markdown TEXT NOT NULL;
|
||||
|
||||
ALTER TABLE model_weights
|
||||
CHANGE maybe_description_rendered_html description_rendered_html TEXT NOT NULL;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights
|
||||
CHANGE description_markdown maybe_description_markdown TEXT DEFAULT NULL;
|
||||
|
||||
ALTER TABLE model_weights
|
||||
CHANGE description_rendered_html maybe_description_rendered_html TEXT DEFAULT NULL;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
drop table entity_stats;
|
||||
@@ -0,0 +1,56 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Statistics about any entity. Typically model weights and media files.
|
||||
CREATE TABLE entity_stats (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- ========== ENTITY LINKAGE ==========
|
||||
|
||||
-- The type of record this is attached to
|
||||
-- Currently supported values:
|
||||
-- * 'model_weight'
|
||||
-- * 'media_file'
|
||||
-- * 'comment'
|
||||
entity_type VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The token for the record.
|
||||
entity_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- ========== MODEL DESCRIPTION ==========
|
||||
|
||||
|
||||
-- Total positive ratings
|
||||
-- Total overall ratings = positive + negative
|
||||
ratings_positive_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total negative ratings
|
||||
-- Total overall ratings = positive + negative
|
||||
ratings_negative_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total number of user bookmarks
|
||||
bookmark_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total number of views
|
||||
-- view_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total number of views
|
||||
-- play_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- When the cached ratings were last calculated and updated.
|
||||
-- maybe_last_backfilled_at TIMESTAMP DEFAULT NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (entity_type, entity_token),
|
||||
KEY index_entity_type (entity_type),
|
||||
KEY index_entity_token (entity_token)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
@@ -0,0 +1,23 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights ADD COLUMN
|
||||
cached_user_ratings_total_count INT(10) UNSIGNED NOT NULL DEFAULT 0
|
||||
AFTER maybe_public_bucket_extension;
|
||||
|
||||
ALTER TABLE model_weights ADD COLUMN
|
||||
cached_user_ratings_positive_count INT(10) UNSIGNED NOT NULL DEFAULT 0
|
||||
AFTER cached_user_ratings_total_count;
|
||||
|
||||
ALTER TABLE model_weights ADD COLUMN
|
||||
cached_user_ratings_negative_count INT(10) UNSIGNED NOT NULL DEFAULT 0
|
||||
AFTER cached_user_ratings_positive_count;
|
||||
|
||||
ALTER TABLE model_weights ADD COLUMN
|
||||
maybe_cached_user_ratings_ratio FLOAT
|
||||
AFTER cached_user_ratings_negative_count;
|
||||
|
||||
ALTER TABLE model_weights ADD COLUMN
|
||||
cached_user_ratings_last_updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
AFTER maybe_cached_user_ratings_ratio;
|
||||
@@ -0,0 +1,13 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
ALTER TABLE model_weights DROP COLUMN cached_user_ratings_total_count;
|
||||
|
||||
ALTER TABLE model_weights DROP COLUMN cached_user_ratings_positive_count;
|
||||
|
||||
ALTER TABLE model_weights DROP COLUMN cached_user_ratings_negative_count;
|
||||
|
||||
ALTER TABLE model_weights DROP COLUMN maybe_cached_user_ratings_ratio;
|
||||
|
||||
ALTER TABLE model_weights DROP COLUMN cached_user_ratings_last_updated_at;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
DROP INDEX unique_index_user_type_token ON user_bookmarks;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
CREATE UNIQUE INDEX unique_index_user_type_token
|
||||
ON user_bookmarks (user_token, entity_type, entity_token);
|
||||
@@ -0,0 +1,56 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Statistics about any entity. Typically model weights and media files.
|
||||
CREATE TABLE entity_stats (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- ========== ENTITY LINKAGE ==========
|
||||
|
||||
-- The type of record this is attached to
|
||||
-- Currently supported values:
|
||||
-- * 'model_weight'
|
||||
-- * 'media_file'
|
||||
-- * 'comment'
|
||||
entity_type VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The token for the record.
|
||||
entity_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- ========== MODEL DESCRIPTION ==========
|
||||
|
||||
|
||||
-- Total positive ratings
|
||||
-- Total overall ratings = positive + negative
|
||||
ratings_positive_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total negative ratings
|
||||
-- Total overall ratings = positive + negative
|
||||
ratings_negative_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total number of user bookmarks
|
||||
bookmark_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total number of views
|
||||
-- view_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total number of views
|
||||
-- play_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- When the cached ratings were last calculated and updated.
|
||||
-- maybe_last_backfilled_at TIMESTAMP DEFAULT NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (entity_type, entity_token),
|
||||
KEY index_entity_type (entity_type),
|
||||
KEY index_entity_token (entity_token)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
@@ -39,23 +39,19 @@ CREATE TABLE model_weights (
|
||||
-- The "name" of the model, which might be complicated.
|
||||
title VARCHAR(255) NOT NULL,
|
||||
|
||||
-- TODO(bt, 2023-12-14): Delete the `maybe_thumbnail_token` column later.
|
||||
-- We're using other columns instead.
|
||||
maybe_thumbnail_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The "avatar" image is a media file of type image that serves as a
|
||||
-- small avatar or profile picture icon.
|
||||
maybe_avatar_media_file_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The "cover" image is a media file of type image that covers the
|
||||
-- top of the page.
|
||||
maybe_cover_media_file_token VARCHAR(32) DEFAULT NULL,
|
||||
-- The "cover" image is a media file of type image that severs as a small
|
||||
-- example of the model. Like album art or a user profile picture / avatar.
|
||||
maybe_cover_image_media_file_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The description of the model in markdown.
|
||||
description_markdown TEXT NOT NULL,
|
||||
-- This is optional, since not all weights are of the same caliber (eg. zero shot models
|
||||
-- don't deserve a description).
|
||||
maybe_description_markdown TEXT DEFAULT NULL,
|
||||
|
||||
-- Generated HTML (not user-editable).
|
||||
description_rendered_html TEXT NOT NULL,
|
||||
-- This is optional, since not all weights are of the same caliber (eg. zero shot
|
||||
-- models don't deserve a description).
|
||||
maybe_description_rendered_html TEXT DEFAULT NULL,
|
||||
|
||||
|
||||
-- ========== CREATOR DETAILS ==========
|
||||
@@ -144,26 +140,6 @@ CREATE TABLE model_weights (
|
||||
-- is_locked_from_user_modification BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
|
||||
|
||||
-- ========== RATING AND RANKING ==========
|
||||
|
||||
-- User ratings are cached on the model, but are *not* a source of truth.
|
||||
-- Total count only includes "positive" and "negative" votes, not neutral ones.
|
||||
cached_user_ratings_total_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total positive
|
||||
cached_user_ratings_positive_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- Total negative
|
||||
cached_user_ratings_negative_count INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
|
||||
-- User ratings are cached on the model, but are *not* a source of truth.
|
||||
-- Total count only includes "positive" and "negative" votes, not neutral ones.
|
||||
maybe_cached_user_ratings_ratio FLOAT,
|
||||
|
||||
-- When the cached ratings were last calculated and updated.
|
||||
cached_user_ratings_last_updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
|
||||
-- ========== MIGRATION DETAILS ==========
|
||||
|
||||
-- If migrated from another table, this is the token of the original model.
|
||||
@@ -194,7 +170,6 @@ CREATE TABLE model_weights (
|
||||
KEY index_weights_category (weights_category),
|
||||
KEY fk_creator_user_token (creator_user_token),
|
||||
KEY index_creator_set_visibility (creator_set_visibility),
|
||||
KEY fk_maybe_avatar_media_file_token (maybe_avatar_media_file_token),
|
||||
KEY fk_maybe_cover_media_file_token (maybe_cover_media_file_token)
|
||||
KEY fk_maybe_cover_media_file_token (maybe_cover_image_media_file_token)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
-- Favorites that can be attached to just about anything.
|
||||
-- This is a polymorphic table and can apply to a wide variety of entities.
|
||||
CREATE TABLE user_bookmarks
|
||||
(
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- Effective "primary key" (PUBLIC)
|
||||
token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- User making the favorite
|
||||
user_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The type of entity the favorite applies to
|
||||
entity_type VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The token of the entity the favorite applies to
|
||||
entity_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- ========== VECTOR CLOCK ==========
|
||||
|
||||
-- Incremented with every update.
|
||||
version INT NOT NULL DEFAULT 0,
|
||||
|
||||
-- ========== TIMESTAMPS ==========
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (token),
|
||||
UNIQUE KEY (user_token, entity_type, entity_token),
|
||||
KEY index_entity_type_entity_token (entity_type, entity_token),
|
||||
KEY index_user_token_entity_token (user_token, entity_type),
|
||||
KEY index_user_token (user_token),
|
||||
KEY index_created_at (created_at),
|
||||
KEY index_user_deleted_at (deleted_at)
|
||||
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_bin;
|
||||
@@ -0,0 +1 @@
|
||||
pub mod stats_entity_type;
|
||||
@@ -0,0 +1,121 @@
|
||||
use std::collections::BTreeSet;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
#[cfg(test)]
|
||||
use strum::EnumCount;
|
||||
#[cfg(test)]
|
||||
use strum::EnumIter;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
/// Used in the `user_stats` table in a `VARCHAR(32)` field named `entity_type`.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Deserialize, Serialize, ToSchema, Ord, PartialOrd)]
|
||||
pub enum StatsEntityType {
|
||||
/// Comment
|
||||
#[serde(rename = "comment")]
|
||||
Comment,
|
||||
|
||||
/// MediaFile
|
||||
#[serde(rename = "media_file")]
|
||||
MediaFile,
|
||||
|
||||
/// ModelWeight (the new way to store models)
|
||||
#[serde(rename = "model_weight")]
|
||||
ModelWeight,
|
||||
}
|
||||
|
||||
// TODO(bt, 2023-01-17): This desperately needs MySQL integration tests!
|
||||
impl_enum_display_and_debug_using_to_str!(StatsEntityType);
|
||||
impl_mysql_enum_coders!(StatsEntityType);
|
||||
impl_mysql_from_row!(StatsEntityType);
|
||||
|
||||
/// NB: Legacy API for older code.
|
||||
impl StatsEntityType {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Comment => "comment",
|
||||
Self::MediaFile => "media_file",
|
||||
Self::ModelWeight => "model_weight",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_str(value: &str) -> Result<Self, String> {
|
||||
match value {
|
||||
"comment" => Ok(Self::Comment),
|
||||
"media_file" => Ok(Self::MediaFile),
|
||||
"model_weight" => Ok(Self::ModelWeight),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn all_variants() -> BTreeSet<Self> {
|
||||
// NB: BTreeSet is sorted
|
||||
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
|
||||
BTreeSet::from([
|
||||
Self::Comment,
|
||||
Self::MediaFile,
|
||||
Self::ModelWeight,
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::by_table::entity_stats::stats_entity_type::StatsEntityType;
|
||||
use crate::test_helpers::assert_serialization;
|
||||
|
||||
mod explicit_checks {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(StatsEntityType::Comment, "comment");
|
||||
assert_serialization(StatsEntityType::MediaFile, "media_file");
|
||||
assert_serialization(StatsEntityType::ModelWeight, "model_weight");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_str() {
|
||||
assert_eq!(StatsEntityType::Comment.to_str(), "comment");
|
||||
assert_eq!(StatsEntityType::MediaFile.to_str(), "media_file");
|
||||
assert_eq!(StatsEntityType::ModelWeight.to_str(), "model_weight");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_str() {
|
||||
assert_eq!(StatsEntityType::from_str("comment").unwrap(), StatsEntityType::Comment);
|
||||
assert_eq!(StatsEntityType::from_str("media_file").unwrap(), StatsEntityType::MediaFile);
|
||||
assert_eq!(StatsEntityType::from_str("model_weight").unwrap(), StatsEntityType::ModelWeight);
|
||||
assert!(StatsEntityType::from_str("foo").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
let mut variants = StatsEntityType::all_variants();
|
||||
assert_eq!(variants.len(), 3);
|
||||
assert_eq!(variants.pop_first(), Some(StatsEntityType::Comment));
|
||||
assert_eq!(variants.pop_first(), Some(StatsEntityType::MediaFile));
|
||||
assert_eq!(variants.pop_first(), Some(StatsEntityType::ModelWeight));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
}
|
||||
}
|
||||
|
||||
mod mechanical_checks {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn variant_length() {
|
||||
use strum::IntoEnumIterator;
|
||||
assert_eq!(StatsEntityType::all_variants().len(), StatsEntityType::iter().len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn round_trip() {
|
||||
for variant in StatsEntityType::all_variants() {
|
||||
assert_eq!(variant, StatsEntityType::from_str(variant.to_str()).unwrap());
|
||||
assert_eq!(variant, StatsEntityType::from_str(&format!("{}", variant)).unwrap());
|
||||
assert_eq!(variant, StatsEntityType::from_str(&format!("{:?}", variant)).unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,14 @@
|
||||
pub mod audit_logs;
|
||||
pub mod comments;
|
||||
pub mod email_sender_jobs;
|
||||
pub mod entity_stats;
|
||||
pub mod generic_download_jobs;
|
||||
pub mod generic_inference_jobs;
|
||||
pub mod generic_synthetic_ids;
|
||||
pub mod media_files;
|
||||
pub mod media_uploads;
|
||||
pub mod model_categories;
|
||||
pub mod model_weights;
|
||||
pub mod trending_model_analytics;
|
||||
pub mod tts_models;
|
||||
pub mod user_bookmarks;
|
||||
@@ -15,7 +17,6 @@ pub mod user_ratings;
|
||||
pub mod voice_conversion_models;
|
||||
pub mod voice_conversion_results;
|
||||
pub mod zs_voices;
|
||||
pub mod model_weights;
|
||||
// ===== Sqlite =====
|
||||
pub mod tts_render_tasks;
|
||||
pub mod web_rendition_targets;
|
||||
|
||||
@@ -50,6 +50,7 @@ pub enum UserBookmarkEntityType {
|
||||
// TODO(bt, 2023-01-17): This desperately needs MySQL integration tests!
|
||||
impl_enum_display_and_debug_using_to_str!(UserBookmarkEntityType);
|
||||
impl_mysql_enum_coders!(UserBookmarkEntityType);
|
||||
impl_mysql_from_row!(UserBookmarkEntityType);
|
||||
|
||||
/// NB: Legacy API for older code.
|
||||
impl UserBookmarkEntityType {
|
||||
|
||||
@@ -4,10 +4,11 @@ use serde::Serialize;
|
||||
use strum::EnumCount;
|
||||
#[cfg(test)]
|
||||
use strum::EnumIter;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
/// Used in the `user_ratings` table in a `VARCHAR(32)` field named `entity_type`.
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Deserialize, Serialize)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Deserialize, Serialize, ToSchema)]
|
||||
pub enum UserRatingEntityType {
|
||||
/// Media files (inference results, uploads, etc.)
|
||||
#[serde(rename = "media_file")]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
use strum::EnumCount;
|
||||
#[cfg(test)]
|
||||
use strum::EnumIter;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
/// UserRatingValue
|
||||
///
|
||||
@@ -17,7 +18,7 @@ use strum::EnumIter;
|
||||
/// *DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY!*
|
||||
///
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type, ToSchema)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[sqlx(rename_all = "lowercase")]
|
||||
pub enum UserRatingValue {
|
||||
|
||||
@@ -3,3 +3,4 @@ pub mod job_status_plus;
|
||||
pub mod sqlite;
|
||||
pub mod visibility;
|
||||
pub mod vocoder_type;
|
||||
pub mod view_as;
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
#[cfg(test)]
|
||||
use strum::EnumCount;
|
||||
#[cfg(test)]
|
||||
use strum::EnumIter;
|
||||
|
||||
|
||||
use utoipa::ToSchema;
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Deserialize, Serialize, sqlx::Type,ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[sqlx(rename_all = "snake_case")]
|
||||
pub enum ViewAs {
|
||||
/// Public entities are able to be listed in public lists.
|
||||
/// It does not mean that they necessarily will be (eg. they could be "mod unapproved" or deleted).
|
||||
Author,
|
||||
/// Hidden entities are not shown in public lists, but the URL to them may be given out freely.
|
||||
/// They are available to non-logged-in users as long as they have the URL.
|
||||
Moderator,
|
||||
/// Private entities should only be available to the creator, a list of approved users, and
|
||||
/// website moderation staff.
|
||||
AnotherUser,
|
||||
}
|
||||
|
||||
|
||||
impl_enum_display_and_debug_using_to_str!(ViewAs);
|
||||
impl_mysql_from_row!(ViewAs);
|
||||
|
||||
impl Default for ViewAs {
|
||||
fn default() -> Self { Self::AnotherUser }
|
||||
}
|
||||
|
||||
/// NB: Legacy API for older code.
|
||||
impl ViewAs {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Author => "author",
|
||||
Self::Moderator => "moderator",
|
||||
Self::AnotherUser => "another_user",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_str(value: &str) -> Result<Self, String> {
|
||||
match value {
|
||||
"author" => Ok(Self::Author),
|
||||
"moderator" => Ok(Self::Moderator),
|
||||
"another_user" => Ok(Self::AnotherUser),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::common::view_as::ViewAs;
|
||||
use crate::test_helpers::assert_serialization;
|
||||
|
||||
#[test]
|
||||
fn test_default() {
|
||||
assert_eq!(ViewAs::default(), ViewAs::AnotherUser);
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(ViewAs::Author, "author");
|
||||
assert_serialization(ViewAs::Moderator, "moderator");
|
||||
assert_serialization(ViewAs::AnotherUser, "another_user");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_str() {
|
||||
assert_eq!(ViewAs::Author.to_str(), "author");
|
||||
assert_eq!(ViewAs::Moderator.to_str(), "moderator");
|
||||
assert_eq!(ViewAs::AnotherUser.to_str(), "another_user");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_str() {
|
||||
assert_eq!(ViewAs::from_str("author").unwrap(), ViewAs::Author);
|
||||
assert_eq!(ViewAs::from_str("moderator").unwrap(), ViewAs::Moderator);
|
||||
assert_eq!(ViewAs::from_str("another_user").unwrap(), ViewAs::AnotherUser);
|
||||
assert!(ViewAs::from_str("foo").is_err());
|
||||
}
|
||||
|
||||
mod traits {
|
||||
use crate::common::view_as::ViewAs;
|
||||
|
||||
#[test]
|
||||
fn display() {
|
||||
let view_as = ViewAs::Moderator;
|
||||
assert_eq!(format!("{}", view_as), "moderator".to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn debug() {
|
||||
let view_as = ViewAs::Moderator;
|
||||
assert_eq!(format!("{:?}", view_as), "moderator".to_string());
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||
struct CompositeType {
|
||||
view_as: ViewAs,
|
||||
string: String,
|
||||
}
|
||||
|
||||
mod serde_serialization {
|
||||
use crate::common::view_as::ViewAs;
|
||||
|
||||
use super::CompositeType;
|
||||
|
||||
#[test]
|
||||
fn serialize() {
|
||||
let expected = "\"author\"".to_string(); // NB: Quoted
|
||||
|
||||
assert_eq!(expected, toml::to_string(&ViewAs::Author).unwrap());
|
||||
|
||||
// Just to show this serializes the same as a string
|
||||
assert_eq!(expected, toml::to_string("author").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested_serialize() {
|
||||
let value = CompositeType { view_as: ViewAs::Moderator, string: "bar".to_string() };
|
||||
let expected = r#"{"view_as":"moderator","string":"bar"}"#.to_string();
|
||||
assert_eq!(expected, serde_json::to_string(&value).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
mod serde_deserialization {
|
||||
use crate::common::view_as::ViewAs;
|
||||
|
||||
use super::CompositeType;
|
||||
|
||||
#[test]
|
||||
fn deserialize() {
|
||||
let payload = "\"another_user\""; // NB: Quoted
|
||||
let value: ViewAs = serde_json::from_str(payload).unwrap();
|
||||
assert_eq!(value, ViewAs::AnotherUser);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested_deserialize() {
|
||||
let payload = r#"{"view_as":"another_user","string":"bar"}"#.to_string();
|
||||
let expected = CompositeType {
|
||||
view_as: ViewAs::AnotherUser,
|
||||
string: "bar".to_string(),
|
||||
};
|
||||
|
||||
assert_eq!(expected, serde_json::from_str::<CompositeType>(&payload).unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,11 +47,11 @@ pub async fn main() -> AnyhowResult<()> {
|
||||
maybe_bucket_clients = Some(get_bucket_clients()?);
|
||||
}
|
||||
|
||||
let mut maybe_elasticsearch = None;
|
||||
|
||||
if args.seed_elasticsearch {
|
||||
maybe_elasticsearch = Some(get_elasticsearch_client());
|
||||
}
|
||||
// let mut maybe_elasticsearch = None;
|
||||
//
|
||||
// if args.seed_elasticsearch {
|
||||
// maybe_elasticsearch = Some(get_elasticsearch_client());
|
||||
// }
|
||||
|
||||
seed_user_accounts(&pool).await?;
|
||||
seed_media_files(&pool, maybe_bucket_clients.as_ref()).await?;
|
||||
|
||||
@@ -81,7 +81,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
*Thank you for your continued support and feedback!*
|
||||
"#;
|
||||
|
||||
let sd1_5_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/be706282-2978-42a0-aaa2-73881aad94e9/width=1024/00049-2287632957-1girl,face,curly%20hair,red%20hair,white%20background,.jpeg";
|
||||
let _sd1_5_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/be706282-2978-42a0-aaa2-73881aad94e9/width=1024/00049-2287632957-1girl,face,curly%20hair,red%20hair,white%20background,.jpeg";
|
||||
|
||||
// create a loop that loops from 1 to 100
|
||||
for i in 1..=100 {
|
||||
@@ -111,16 +111,15 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
let mut description_rendered_html;
|
||||
let mut original_filename;
|
||||
let mut original_download_url;
|
||||
let mut thumbnail_token;
|
||||
|
||||
let mut private_bucket_hash:String = "".to_string();
|
||||
|
||||
let mut _private_bucket_hash:String = "".to_string();
|
||||
let mut private_bucket_prefix;
|
||||
let mut private_bucket_extension;
|
||||
|
||||
let mut cached_user_ratings_total_count;
|
||||
let mut cached_user_ratings_positive_count;
|
||||
let mut cached_user_ratings_negative_count;
|
||||
let mut cached_user_ratings_ratio;
|
||||
//let mut cached_user_ratings_total_count;
|
||||
//let mut cached_user_ratings_positive_count;
|
||||
//let mut cached_user_ratings_negative_count;
|
||||
//let mut cached_user_ratings_ratio;
|
||||
let mut version;
|
||||
|
||||
match i {
|
||||
@@ -140,16 +139,13 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
original_filename = format!("gura_gwar{}.safetensors", i);
|
||||
original_download_url = format!("www.google.ca");
|
||||
|
||||
// NOTE TO SELF this will be a join for later on for now they can use this.
|
||||
thumbnail_token = "";
|
||||
|
||||
// private_bucket_hash = format!("bucket_hash{}", i);
|
||||
private_bucket_prefix = format!("_fake");
|
||||
private_bucket_extension = format!("rvcV2");
|
||||
cached_user_ratings_total_count = i;
|
||||
cached_user_ratings_positive_count = i;
|
||||
cached_user_ratings_negative_count = i;
|
||||
cached_user_ratings_ratio = i as u32 / 100;
|
||||
//cached_user_ratings_total_count = i;
|
||||
//cached_user_ratings_positive_count = i;
|
||||
//cached_user_ratings_negative_count = i;
|
||||
//cached_user_ratings_ratio = i as u32 / 100;
|
||||
version = i as i32;
|
||||
println!("Seeding RVCv2 model {}", i);
|
||||
},
|
||||
@@ -171,17 +167,14 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
original_filename = format!("filename{}.txt", i);
|
||||
original_download_url = format!("https://civitai.com/api/download/models/149193?type=Model&format=SafeTensor&size=pruned&fp=fp16");
|
||||
|
||||
// NOTE TO SELF this will be a join for later on for now they can use this.
|
||||
thumbnail_token = "";
|
||||
|
||||
// private_bucket_hash = format!("bucket_hash{}", i);
|
||||
private_bucket_prefix = format!("_fake");
|
||||
private_bucket_extension = format!("tt2");
|
||||
|
||||
cached_user_ratings_total_count = i;
|
||||
cached_user_ratings_positive_count = i;
|
||||
cached_user_ratings_negative_count = i;
|
||||
cached_user_ratings_ratio = i as u32 / 100;
|
||||
//cached_user_ratings_total_count = i;
|
||||
//cached_user_ratings_positive_count = i;
|
||||
//cached_user_ratings_negative_count = i;
|
||||
//cached_user_ratings_ratio = i as u32 / 100;
|
||||
version = i as i32;
|
||||
println!("Seeding TT2 model {}", i);
|
||||
},
|
||||
@@ -197,17 +190,14 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
original_filename = format!("filename{}.txt", i);
|
||||
original_download_url = format!("https://civitai.com/api/download/models/149193?type=Model&format=SafeTensor&size=pruned&fp=fp16");
|
||||
|
||||
// NOTE TO SELF this will be a join for later on for now they can use this.
|
||||
thumbnail_token = ""; //sd1_5_image_token;
|
||||
|
||||
// private_bucket_hash = format!("bucket_hash{}", i);
|
||||
private_bucket_prefix = format!("_fake");
|
||||
private_bucket_extension = format!("sd15");
|
||||
|
||||
cached_user_ratings_total_count = i;
|
||||
cached_user_ratings_positive_count = i;
|
||||
cached_user_ratings_negative_count = i;
|
||||
cached_user_ratings_ratio = i as u32 / 100;
|
||||
//cached_user_ratings_total_count = i;
|
||||
//cached_user_ratings_positive_count = i;
|
||||
//cached_user_ratings_negative_count = i;
|
||||
//cached_user_ratings_ratio = i as u32 / 100;
|
||||
version = i as i32;
|
||||
println!("Seeding SD15 model {}", i);
|
||||
},
|
||||
@@ -230,7 +220,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
|
||||
Have fun! 😊
|
||||
"#;
|
||||
let sdxl_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/be706282-2978-42a0-aaa2-73881aad94e9/width=1024/00049-2287632957-1girl,face,curly%20hair,red%20hair,white%20background,.jpeg";
|
||||
let _sdxl_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/be706282-2978-42a0-aaa2-73881aad94e9/width=1024/00049-2287632957-1girl,face,curly%20hair,red%20hair,white%20background,.jpeg";
|
||||
|
||||
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
title = format!("SDXL_Niji_Special Edition: {}", i);
|
||||
@@ -245,13 +235,10 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
original_filename = format!("filename{}.txt", i);
|
||||
original_download_url = format!("https://civitai.com/api/download/models/149193?type=Model&format=SafeTensor&size=pruned&fp=fp16");
|
||||
|
||||
// NOTE TO SELF this will be a join for later on for now they can use this.
|
||||
thumbnail_token = "";
|
||||
|
||||
cached_user_ratings_total_count = i;
|
||||
cached_user_ratings_positive_count = i;
|
||||
cached_user_ratings_negative_count = i;
|
||||
cached_user_ratings_ratio = i as u32 / 100;
|
||||
//cached_user_ratings_total_count = i;
|
||||
//cached_user_ratings_positive_count = i;
|
||||
//cached_user_ratings_negative_count = i;
|
||||
//cached_user_ratings_ratio = i as u32 / 100;
|
||||
version = i as i32;
|
||||
println!("Seeding SDXL model {}", i);
|
||||
},
|
||||
@@ -262,7 +249,7 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
- LoRA Gawr Gura
|
||||
"#;
|
||||
|
||||
let lora_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/123645df-dee2-4239-863a-76a150b09c32/width=1024/00000-2171948503.jpeg";
|
||||
let _lora_image_token = "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/123645df-dee2-4239-863a-76a150b09c32/width=1024/00000-2171948503.jpeg";
|
||||
model_weight_token = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
title = format!("Gawr Gura LoRA: {}", i);
|
||||
|
||||
@@ -273,17 +260,14 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
original_filename = format!("filename{}.txt", i);
|
||||
original_download_url = format!("https://civitai.com/api/download/models/149193?type=Model&format=SafeTensor&size=pruned&fp=fp16");
|
||||
|
||||
// NOTE TO SELF this will be a join for later on for now they can use this.
|
||||
thumbnail_token = ""; // lora_image_token;
|
||||
|
||||
// private_bucket_hash = format!("bucket_hash{}", i);
|
||||
private_bucket_prefix = format!("_fake");
|
||||
private_bucket_extension = format!("loRA");
|
||||
|
||||
cached_user_ratings_total_count = i;
|
||||
cached_user_ratings_positive_count = i;
|
||||
cached_user_ratings_negative_count = i;
|
||||
cached_user_ratings_ratio = i as u32 / 100;
|
||||
//cached_user_ratings_total_count = i;
|
||||
//cached_user_ratings_positive_count = i;
|
||||
//cached_user_ratings_negative_count = i;
|
||||
//cached_user_ratings_ratio = i as u32 / 100;
|
||||
version = i as i32;
|
||||
println!("Seeding LoRA model {}", i);
|
||||
},
|
||||
@@ -303,16 +287,13 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
original_filename = format!("gura_gwar{}.safetensors", i);
|
||||
original_download_url = format!("www.google.ca");
|
||||
|
||||
// NOTE TO SELF this will be a join for later on for now they can use this.
|
||||
thumbnail_token = "";
|
||||
|
||||
// private_bucket_hash = format!("bucket_hash{}", i);
|
||||
private_bucket_prefix = format!("_fake");
|
||||
private_bucket_extension = format!("rvcV2");
|
||||
cached_user_ratings_total_count = i;
|
||||
cached_user_ratings_positive_count = i;
|
||||
cached_user_ratings_negative_count = i;
|
||||
cached_user_ratings_ratio = i as u32 / 100;
|
||||
//cached_user_ratings_total_count = i;
|
||||
//cached_user_ratings_positive_count = i;
|
||||
//cached_user_ratings_negative_count = i;
|
||||
//cached_user_ratings_ratio = i as u32 / 100;
|
||||
version = i as i32;
|
||||
|
||||
println!("Out of range");
|
||||
@@ -324,9 +305,8 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
weights_type: weights_types, // replace with actual WeightsType
|
||||
weights_category, // replace with actual WeightsCategory
|
||||
title,
|
||||
maybe_thumbnail_token: Some(thumbnail_token.to_string()),
|
||||
description_markdown: description,
|
||||
description_rendered_html: description_rendered_html.to_string(),
|
||||
maybe_description_markdown: Some(description),
|
||||
maybe_description_rendered_html: Some(description_rendered_html.to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -338,10 +318,10 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
|
||||
public_bucket_hash: "bucket_hash1".to_string(),
|
||||
maybe_public_bucket_prefix: Some(private_bucket_prefix),
|
||||
maybe_public_bucket_extension: Some(private_bucket_extension),
|
||||
cached_user_ratings_total_count,
|
||||
cached_user_ratings_positive_count,
|
||||
cached_user_ratings_negative_count,
|
||||
maybe_cached_user_ratings_ratio: Some(cached_user_ratings_ratio as f32),
|
||||
//cached_user_ratings_total_count,
|
||||
//cached_user_ratings_positive_count,
|
||||
//cached_user_ratings_negative_count,
|
||||
//maybe_cached_user_ratings_ratio: Some(cached_user_ratings_ratio as f32),
|
||||
version,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
};
|
||||
@@ -370,9 +350,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 1".to_string()),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -384,10 +363,10 @@ pub async fn seed_weights_for_user_token(
|
||||
public_bucket_hash: "bucket_hash1".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("rvc".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
},
|
||||
@@ -396,9 +375,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::HifiganTacotron2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::TextToSpeech, // replace with actual WeightsCategory
|
||||
title: "Title 2".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 2".to_string()),
|
||||
description_markdown: "Description 2".to_string(),
|
||||
description_rendered_html: "<p>Description 2</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 2".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 2</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "292.268.2.2",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -410,10 +388,10 @@ pub async fn seed_weights_for_user_token(
|
||||
public_bucket_hash: "bucket_hash2".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("tt2".to_string()),
|
||||
cached_user_ratings_total_count: 20,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 2,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 20,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 2,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 2,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
},
|
||||
@@ -422,9 +400,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 3".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 3".to_string()),
|
||||
description_markdown: "Description 3".to_string(),
|
||||
description_rendered_html: "<p>Description 3</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 3".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 3</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "392.368.3.3",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -436,10 +413,10 @@ pub async fn seed_weights_for_user_token(
|
||||
public_bucket_hash: "bucket_hash3".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("safetensors".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
},
|
||||
@@ -448,9 +425,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 4".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 4".to_string()),
|
||||
description_markdown: "Description 4".to_string(),
|
||||
description_rendered_html: "<p>Description 4</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 4".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 4</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -462,10 +438,10 @@ pub async fn seed_weights_for_user_token(
|
||||
public_bucket_hash: "bucket_hash4".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("LoRA".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 2,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
},
|
||||
@@ -474,9 +450,8 @@ pub async fn seed_weights_for_user_token(
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 5".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 4".to_string()),
|
||||
description_markdown: "Description 4".to_string(),
|
||||
description_rendered_html: "<p>Description 4</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 4".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 4</p>".to_string()),
|
||||
creator_user_token: Some(&user_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -488,10 +463,10 @@ pub async fn seed_weights_for_user_token(
|
||||
public_bucket_hash: "bucket_hash4".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("LoRA".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 2,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
}
|
||||
@@ -504,7 +479,7 @@ pub async fn seed_weights_for_user_token(
|
||||
}
|
||||
|
||||
|
||||
pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToken) -> AnyhowResult<()> {
|
||||
pub async fn original_seed_weights(mysql_pool: &Pool<MySql>, _user_token: UserToken) -> AnyhowResult<()> {
|
||||
let model_weight_token1 = ModelWeightToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
let creator_token1 = UserToken::generate_for_testing_and_dev_seeding_never_use_in_production_seriously();
|
||||
|
||||
@@ -526,9 +501,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 1".to_string()),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token1), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -540,10 +514,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
public_bucket_hash: "bucket_hash1".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("rvc".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
},
|
||||
@@ -552,9 +526,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::HifiganTacotron2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::TextToSpeech, // replace with actual WeightsCategory
|
||||
title: "Title 2".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 2".to_string()),
|
||||
description_markdown: "Description 2".to_string(),
|
||||
description_rendered_html: "<p>Description 2</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 2".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 2</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token2), // replace with actual UserToken
|
||||
creator_ip_address: "292.268.2.2",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -566,10 +539,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
public_bucket_hash: "bucket_hash2".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("tt2".to_string()),
|
||||
cached_user_ratings_total_count: 20,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 2,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 20,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 2,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 2,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
},
|
||||
@@ -578,9 +551,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 3".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 3".to_string()),
|
||||
description_markdown: "Description 3".to_string(),
|
||||
description_rendered_html: "<p>Description 3</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 3".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 3</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token3), // replace with actual UserToken
|
||||
creator_ip_address: "392.368.3.3",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -592,10 +564,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
public_bucket_hash: "bucket_hash3".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("safetensors".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
},
|
||||
@@ -604,9 +576,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 4".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 4".to_string()),
|
||||
description_markdown: "Description 4".to_string(),
|
||||
description_rendered_html: "<p>Description 4</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 4".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 4</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token4), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -618,10 +589,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
public_bucket_hash: "bucket_hash4".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("LoRA".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 2,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
},
|
||||
@@ -630,9 +601,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
weights_type: WeightsType::LoRA, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory
|
||||
title: "Title 5".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 5".to_string()),
|
||||
description_markdown: "Description 5".to_string(),
|
||||
description_rendered_html: "<p>Description 5</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 5".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 5</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token5), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -644,10 +614,10 @@ pub async fn original_seed_weights(mysql_pool: &Pool<MySql>,user_token: UserToke
|
||||
public_bucket_hash: "bucket_hash5".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("LoRA".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 2,
|
||||
mysql_pool: &mysql_pool, // replace with actual MySqlPool
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ pub async fn seed_weights_files(
|
||||
|
||||
for (
|
||||
user_token,
|
||||
weights_file_token,
|
||||
_weights_file_token,
|
||||
weights_type,
|
||||
weights_category,
|
||||
model_name,
|
||||
@@ -92,16 +92,15 @@ pub async fn seed_weights_files(
|
||||
let description_rendered_html = "This is a description rendered html";
|
||||
let original_filename = "model.safetensors";
|
||||
let original_download_url = "https://example.com/model.safetensors";
|
||||
let thumbnail_token = format!("{}", n);
|
||||
|
||||
// let public_bucket_hash: String = weights_file_token.to_string();
|
||||
// let public_bucket_prefix = weights_type.to_string();
|
||||
// let public_bucket_extension = weights_category.to_string();
|
||||
|
||||
let cached_user_ratings_total_count = n.clone();
|
||||
let cached_user_ratings_positive_count = n.clone();
|
||||
let cached_user_ratings_negative_count = n.clone();
|
||||
let cached_user_ratings_ratio = 100.0 as f32;
|
||||
//let cached_user_ratings_total_count = n.clone();
|
||||
//let cached_user_ratings_positive_count = n.clone();
|
||||
//let cached_user_ratings_negative_count = n.clone();
|
||||
//let cached_user_ratings_ratio = 100.0 as f32;
|
||||
let version = 1;
|
||||
|
||||
// get the abs path of the weights file to upload.
|
||||
@@ -130,9 +129,8 @@ pub async fn seed_weights_files(
|
||||
weights_type, // Assuming weights_type is defined elsewhere
|
||||
weights_category, // Assuming weights_category is defined elsewhere
|
||||
title: title.to_string(),
|
||||
maybe_thumbnail_token: Some(thumbnail_token),
|
||||
description_markdown: description.to_string(),
|
||||
description_rendered_html: description_rendered_html.to_string(),
|
||||
maybe_description_markdown: Some(description.to_string()),
|
||||
maybe_description_rendered_html: Some(description_rendered_html.to_string()),
|
||||
creator_user_token: Some(&user_token),
|
||||
creator_ip_address: "127.0.0.1", // Assuming the IP address is localhost
|
||||
creator_set_visibility: Visibility::Public, // Assuming the visibility is public
|
||||
@@ -144,10 +142,10 @@ pub async fn seed_weights_files(
|
||||
public_bucket_hash: bucket_hash,
|
||||
maybe_public_bucket_prefix: Some(maybe_bucket_prefix.to_string()),
|
||||
maybe_public_bucket_extension: Some(maybe_bucket_extension.to_string()),
|
||||
cached_user_ratings_total_count,
|
||||
cached_user_ratings_positive_count,
|
||||
cached_user_ratings_negative_count,
|
||||
maybe_cached_user_ratings_ratio: Some(cached_user_ratings_ratio),
|
||||
//cached_user_ratings_total_count,
|
||||
//cached_user_ratings_positive_count,
|
||||
//cached_user_ratings_negative_count,
|
||||
//maybe_cached_user_ratings_ratio: Some(cached_user_ratings_ratio),
|
||||
version,
|
||||
mysql_pool: &mysql_pool, // Assuming mysql_pool is defined elsewhere
|
||||
};
|
||||
@@ -170,9 +168,9 @@ struct BucketDetails {
|
||||
}
|
||||
|
||||
async fn seed_model(
|
||||
mysql_pool: &Pool<MySql>,
|
||||
model_weight_token: &ModelWeightToken,
|
||||
user_token: &UserToken,
|
||||
_mysql_pool: &Pool<MySql>,
|
||||
_model_weight_token: &ModelWeightToken,
|
||||
_user_token: &UserToken,
|
||||
weight_type: WeightsType,
|
||||
weight_file_path: &Path,
|
||||
maybe_bucket_clients: Option<&BucketClients>
|
||||
|
||||
@@ -81,7 +81,7 @@ async fn create_document_from_record(elasticsearch: &Elasticsearch, record: &Tts
|
||||
}
|
||||
|
||||
// NB: Adapted from elasticsearch crate examples source
|
||||
async fn create_tts_model_index(client: &Elasticsearch, delete: bool) -> AnyhowResult<()> {
|
||||
async fn create_tts_model_index(client: &Elasticsearch, _delete: bool) -> AnyhowResult<()> {
|
||||
|
||||
info!("Creating TTS model index...");
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ impl BucketClient {
|
||||
if code != 200 {
|
||||
let body = String::from_utf8_lossy(body_bytes);
|
||||
warn!("upload body: {}", body);
|
||||
return Err(anyhow!("upload failed: {}", code));
|
||||
Err(anyhow!("upload failed: {}", code))
|
||||
} else {
|
||||
info!("upload success: {}", code);
|
||||
Ok(())
|
||||
|
||||
@@ -192,7 +192,7 @@ impl BucketPathUnifier {
|
||||
pub fn w2l_inference_video_output_path(&self, w2l_inference_job_token: &str) -> PathBuf {
|
||||
// NB: We don't want colons from the token in the filename.
|
||||
if w2l_inference_job_token.contains(":") {
|
||||
if let Some((token_type, token)) = w2l_inference_job_token.split_once(":") {
|
||||
if let Some((_token_type, token)) = w2l_inference_job_token.split_once(":") {
|
||||
let video_filename = w2l_inference_job_token.replace(":", "");
|
||||
let video_filename = format!("vocodes_video_{}.mp4", video_filename);
|
||||
|
||||
|
||||
+5
-6
@@ -5,7 +5,6 @@ use async_trait::async_trait;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::bucket_client::BucketClient;
|
||||
use crate::remote_file_manager::file_meta_data::FileMetaData;
|
||||
|
||||
#[async_trait]
|
||||
pub trait BucketOrchestrationCore {
|
||||
@@ -85,11 +84,11 @@ impl BucketOrchestration {
|
||||
public_bucket_name: String,
|
||||
private_bucket_name: String) -> Self {
|
||||
Self {
|
||||
access_key: access_key,
|
||||
secret_key: secret_key,
|
||||
region_name: region_name,
|
||||
public_bucket_name: public_bucket_name,
|
||||
private_bucket_name: private_bucket_name,
|
||||
access_key,
|
||||
secret_key,
|
||||
region_name,
|
||||
public_bucket_name,
|
||||
private_bucket_name,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,18 +7,18 @@ const REMOTE_FILE_DIRECTORY: &str = "/implement_google_cloud_storage_bucket_name
|
||||
pub trait FileDescriptor {
|
||||
// By default a file belongs in the public bucket will help us figureout which bucket to use.
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
return REMOTE_FILE_DIRECTORY;
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file
|
||||
// e.g requires! a period .safetensors .bin .jpg
|
||||
fn get_suffix(&self)->String {
|
||||
return "implement".to_string();
|
||||
"implement".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, loRA, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
return "implement".to_string();
|
||||
"implement".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
|
||||
@@ -32,10 +32,10 @@ pub struct FileBucketDirectory {
|
||||
let full_remote_cloud_file_path = format!("{}/{}", remote_cloud_base_directory , file_name);
|
||||
Self {
|
||||
file_object_hash: entropy.to_string(),
|
||||
remote_cloud_base_directory: remote_cloud_base_directory,
|
||||
full_remote_cloud_file_path: full_remote_cloud_file_path,
|
||||
file_name:file_name,
|
||||
file_descriptor:file_descriptor
|
||||
remote_cloud_base_directory,
|
||||
full_remote_cloud_file_path,
|
||||
file_name,
|
||||
file_descriptor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ pub struct FileBucketDirectory {
|
||||
let full_remote_cloud_file_path = format!("{}/{}", remote_cloud_base_directory , file_name);
|
||||
Self {
|
||||
file_object_hash: entropy,
|
||||
remote_cloud_base_directory: remote_cloud_base_directory,
|
||||
full_remote_cloud_file_path: full_remote_cloud_file_path,
|
||||
file_name:file_name,
|
||||
file_descriptor:file_descriptor
|
||||
remote_cloud_base_directory,
|
||||
full_remote_cloud_file_path,
|
||||
file_name,
|
||||
file_descriptor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-6
@@ -1,7 +1,6 @@
|
||||
|
||||
use crate::remote_file_manager::weights_descriptor::{self};
|
||||
|
||||
use super::file_descriptor::FileDescriptor;
|
||||
use crate::remote_file_manager::weights_descriptor::{WeightsLoRADescriptor, WeightsSD15Descriptor, WeightsSDXLDescriptor, self};
|
||||
|
||||
pub struct RemoteCloudBucketDetails {
|
||||
pub object_hash: String,
|
||||
@@ -12,9 +11,9 @@ pub struct RemoteCloudBucketDetails {
|
||||
impl RemoteCloudBucketDetails {
|
||||
pub fn new(object_hash: String, prefix: String, suffix: String) -> Self {
|
||||
Self {
|
||||
object_hash: object_hash,
|
||||
prefix: prefix,
|
||||
suffix: suffix
|
||||
object_hash,
|
||||
prefix,
|
||||
suffix
|
||||
}
|
||||
}
|
||||
pub fn get_object_hash(&self) -> &str {
|
||||
@@ -49,7 +48,6 @@ impl RemoteCloudBucketDetails {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
pub fn test() {
|
||||
|
||||
|
||||
+14
-18
@@ -1,21 +1,15 @@
|
||||
|
||||
|
||||
use crate::remote_file_manager::file_directory::FileBucketDirectory;
|
||||
use crate::remote_file_manager::remote_cloud_bucket_details::RemoteCloudBucketDetails;
|
||||
|
||||
use super::bucket_orchestration;
|
||||
use super::file_descriptor::{FileDescriptor};
|
||||
use super::file_meta_data::FileMetaData;
|
||||
|
||||
use errors:: AnyhowResult;
|
||||
|
||||
use errors::AnyhowResult;
|
||||
use filesys::file_read_bytes::file_read_bytes;
|
||||
use filesys::file_size::file_size;
|
||||
|
||||
use hashing::sha256::sha256_hash_file::sha256_hash_file;
|
||||
use mimetypes::mimetype_for_bytes::get_mimetype_for_bytes;
|
||||
|
||||
use crate::remote_file_manager::bucket_orchestration::{BucketOrchestrationCore};
|
||||
use crate::remote_file_manager::bucket_orchestration::BucketOrchestrationCore;
|
||||
use crate::remote_file_manager::file_directory::FileBucketDirectory;
|
||||
use crate::remote_file_manager::remote_cloud_bucket_details::RemoteCloudBucketDetails;
|
||||
|
||||
use super::file_descriptor::FileDescriptor;
|
||||
use super::file_meta_data::FileMetaData;
|
||||
|
||||
struct RemoteCloudFileClient {
|
||||
bucket_orchestration_client: Box<dyn BucketOrchestrationCore>
|
||||
@@ -24,7 +18,7 @@ struct RemoteCloudFileClient {
|
||||
impl RemoteCloudFileClient {
|
||||
pub fn new(bucket_orchestration_client: Box<dyn BucketOrchestrationCore>) -> Self {
|
||||
Self {
|
||||
bucket_orchestration_client: bucket_orchestration_client
|
||||
bucket_orchestration_client
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,8 +67,8 @@ impl RemoteCloudFileClient {
|
||||
let mimetype: &str = get_mimetype_for_bytes(&bytes).unwrap_or("application/octet-stream");
|
||||
|
||||
Ok(FileMetaData {
|
||||
file_size_bytes: file_size_bytes,
|
||||
sha256_checksum: sha256_checksum,
|
||||
file_size_bytes,
|
||||
sha256_checksum,
|
||||
mimetype: mimetype.to_string()
|
||||
})
|
||||
}
|
||||
@@ -85,8 +79,9 @@ mod tests {
|
||||
use async_trait::async_trait;
|
||||
use env_logger;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::remote_file_manager::bucket_orchestration::BucketOrchestrationCore;
|
||||
use crate::remote_file_manager::weights_descriptor::{WeightsLoRADescriptor, WeightsSD15Descriptor, WeightsSDXLDescriptor};
|
||||
use crate::remote_file_manager::weights_descriptor::WeightsLoRADescriptor;
|
||||
|
||||
struct BucketOrchestrationMock {}
|
||||
|
||||
@@ -127,7 +122,6 @@ mod tests {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
async fn remote_file_manager_descriptor_test() {
|
||||
use super::*;
|
||||
let remote_cloud_bucket_details = RemoteCloudBucketDetails::new("object_hash".to_string(), "loRA".to_string(), "safetensors".to_string());
|
||||
@@ -138,6 +132,8 @@ mod tests {
|
||||
assert_eq!(file_descriptor.is_public(), true);
|
||||
|
||||
}
|
||||
|
||||
#[ignore]
|
||||
#[tokio::test]
|
||||
async fn remote_file_manager_download_existing_file() {
|
||||
use super::*;
|
||||
|
||||
+28
-28
@@ -1,23 +1,23 @@
|
||||
use super::file_descriptor::FileDescriptor;
|
||||
|
||||
pub struct WeightsLoRADescriptor {}
|
||||
pub struct WeightsLoRADescriptor;
|
||||
|
||||
const REMOTE_FILE_DIRECTORY: &str = "/weights";
|
||||
|
||||
impl FileDescriptor for WeightsLoRADescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
return REMOTE_FILE_DIRECTORY;
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file peroid is handled by the file formatter
|
||||
// e.g safetensors bin jpg
|
||||
fn get_suffix(&self)->String {
|
||||
return "safetensors".to_string();
|
||||
"safetensors".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, loRA, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
return "loRA".to_string();
|
||||
"loRA".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
@@ -26,22 +26,22 @@ impl FileDescriptor for WeightsLoRADescriptor {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WeightsSD15Descriptor {}
|
||||
pub struct WeightsSD15Descriptor;
|
||||
|
||||
impl FileDescriptor for WeightsSD15Descriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
return REMOTE_FILE_DIRECTORY;
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file peroid is handled by the file formatter
|
||||
// e.g safetensors bin jpg
|
||||
fn get_suffix(&self)->String {
|
||||
return "safetensors".to_string();
|
||||
"safetensors".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, SD15, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
return "sd15".to_string();
|
||||
"sd15".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
@@ -51,22 +51,22 @@ impl FileDescriptor for WeightsSD15Descriptor {
|
||||
}
|
||||
|
||||
|
||||
pub struct WeightsSDXLDescriptor {}
|
||||
pub struct WeightsSDXLDescriptor;
|
||||
|
||||
impl FileDescriptor for WeightsSDXLDescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
return REMOTE_FILE_DIRECTORY;
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file peroid is handled by the file formatter
|
||||
// e.g safetensors bin jpg
|
||||
fn get_suffix(&self)->String {
|
||||
return "safetensors".to_string();
|
||||
"safetensors".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, SD15, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
return "sdxl".to_string();
|
||||
"sdxl".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
@@ -75,22 +75,22 @@ impl FileDescriptor for WeightsSDXLDescriptor {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WeightsSVCDescriptor {}
|
||||
pub struct WeightsSVCDescriptor;
|
||||
|
||||
impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsSVCDescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
return REMOTE_FILE_DIRECTORY;
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file peroid is handled by the file formatter
|
||||
// e.g safetensors bin jpg
|
||||
fn get_suffix(&self)->String {
|
||||
return "safetensors".to_string();
|
||||
"safetensors".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, SD15, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
return "svc".to_string();
|
||||
"svc".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
@@ -99,22 +99,22 @@ impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsS
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WeightsRVCDescriptor {}
|
||||
pub struct WeightsRVCDescriptor;
|
||||
|
||||
impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsRVCDescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
return REMOTE_FILE_DIRECTORY;
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file peroid is handled by the file formatter
|
||||
// e.g safetensors bin jpg
|
||||
fn get_suffix(&self)->String {
|
||||
return "pth".to_string();
|
||||
"pth".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, SD15, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
return "rvc".to_string();
|
||||
"rvc".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
@@ -123,22 +123,22 @@ impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsR
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WeightsRVCIndexDescriptor {}
|
||||
pub struct WeightsRVCIndexDescriptor;
|
||||
|
||||
impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsRVCIndexDescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
return REMOTE_FILE_DIRECTORY;
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file peroid is handled by the file formatter
|
||||
// e.g safetensors bin jpg
|
||||
fn get_suffix(&self)->String {
|
||||
return "index".to_string();
|
||||
"index".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, SD15, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
return "rvc".to_string();
|
||||
"rvc".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
@@ -147,22 +147,22 @@ impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsR
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WeightsVallePromptDescriptor {}
|
||||
pub struct WeightsVallePromptDescriptor;
|
||||
|
||||
impl FileDescriptor for crate::remote_file_manager::weights_descriptor::WeightsVallePromptDescriptor {
|
||||
fn remote_directory_path(&self) -> &str {
|
||||
return REMOTE_FILE_DIRECTORY;
|
||||
REMOTE_FILE_DIRECTORY
|
||||
}
|
||||
// this will be the type of file peroid is handled by the file formatter
|
||||
// e.g safetensors bin jpg
|
||||
fn get_suffix(&self)->String {
|
||||
return "safetensors".to_string();
|
||||
"safetensors".to_string()
|
||||
}
|
||||
// This will be the prefix of the media type or the weights type.
|
||||
// name of the weights or the name of the media type
|
||||
// vall-e_prompt, SD15, sd15, sdxl when implmenting add to the end
|
||||
fn get_prefix(&self)->String {
|
||||
return "valle_prompt".to_string();
|
||||
"valle_prompt".to_string()
|
||||
}
|
||||
|
||||
// This will be ensure that the right bucket is picked
|
||||
|
||||
@@ -73,7 +73,7 @@ impl GoogleDriveDownloadCommand {
|
||||
|
||||
info!("Downloading {} to: {}", download_url, temp_filename);
|
||||
|
||||
let mut command = format!("{} --url {} --output_filename {}",
|
||||
let mut command = format!("{} --url \"{}\" --output_filename {}",
|
||||
&self.download_script,
|
||||
download_url,
|
||||
&temp_filename);
|
||||
|
||||
@@ -10,6 +10,14 @@ pub fn is_bad_download_url(url: &str) -> anyhow::Result<bool> {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
let looks_malicious = url.contains("\"")
|
||||
|| url.contains("\'")
|
||||
|| url.contains("\\");
|
||||
|
||||
if looks_malicious {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
let url = Url::parse(url)?;
|
||||
|
||||
match url.host() {
|
||||
@@ -23,6 +31,8 @@ pub fn is_bad_download_url(url: &str) -> anyhow::Result<bool> {
|
||||
|| domain.contains("youtu.be")
|
||||
|| domain.contains("youtube.com");
|
||||
|
||||
println!("domain: {:?}", domain);
|
||||
|
||||
if bad_host {
|
||||
return Ok(true)
|
||||
}
|
||||
@@ -39,15 +49,31 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn bad_download_url() {
|
||||
assert_eq!(is_bad_download_url("").unwrap(), true);
|
||||
assert_eq!(is_bad_download_url(" ").unwrap(), true);
|
||||
assert_eq!(is_bad_download_url("https://vm.tiktok.com/ZMNYjT7Xy/?k=1 ").unwrap(), true); // NB: We get lots of these
|
||||
assert_eq!(is_bad_download_url("https://m.youtube.com/watch?v=HY-vzGBiAZo").unwrap(), true); // NB: We get lots of these
|
||||
assert_eq!(true, is_bad_download_url("").unwrap());
|
||||
assert_eq!(true, is_bad_download_url(" ").unwrap());
|
||||
assert_eq!(true, is_bad_download_url("https://vm.tiktok.com/ZMNYjT7Xy/?k=1 ").unwrap()); // NB: We get lots of these
|
||||
assert_eq!(true, is_bad_download_url("https://m.youtube.com/watch?v=HY-vzGBiAZo").unwrap()); // NB: We get lots of these
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn attacker_urls() {
|
||||
// NB: These URLs may break escaping
|
||||
assert_eq!(true, is_bad_download_url("https://huggingface.co/\"").unwrap());
|
||||
assert_eq!(true, is_bad_download_url("https://huggingface.co/\"/bin/bash").unwrap());
|
||||
assert_eq!(true, is_bad_download_url("https://huggingface.co/\\\'").unwrap());
|
||||
assert_eq!(true, is_bad_download_url("https://huggingface.co/\\\"").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn good_tts_model_url() {
|
||||
assert_eq!(is_bad_download_url("https://drive.google.com/file/d/1-1kEoX4HGCwJm4R9cZhSVByWmUoQVGVm/view").unwrap(), false);
|
||||
assert_eq!(is_bad_download_url("https://drive.google.com/file/d/1SofQhvSkDY-vi_zuBfHivBbJo4CqhJeH/view?usp=sharing").unwrap(), false);
|
||||
assert_eq!(false, is_bad_download_url("https://drive.google.com/file/d/1-1kEoX4HGCwJm4R9cZhSVByWmUoQVGVm/view").unwrap());
|
||||
assert_eq!(false, is_bad_download_url("https://drive.google.com/file/d/1SofQhvSkDY-vi_zuBfHivBbJo4CqhJeH/view?usp=sharing").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tricky_download_urls() {
|
||||
// NB: These are URLs that have caused problems
|
||||
assert_eq!(false, is_bad_download_url("https://huggingface.co/aaalby/nmixx/resolve/main/kyujin(1).zip").unwrap());
|
||||
assert_eq!(false, is_bad_download_url("https://huggingface.co/datasets/Roscall/Elvis70s/resolve/main/Elvis%2070s%20RVC.zip?download=true").unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
pub mod tts_model_document;
|
||||
pub mod tts_model_document;
|
||||
mod model_weight_document;
|
||||
@@ -0,0 +1,65 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
|
||||
use enums::common::visibility::Visibility;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
use crate::traits::document::Document;
|
||||
|
||||
/// The current name for the index.
|
||||
/// We may need to perform migrations in the future
|
||||
pub const MODEL_WEIGHT_INDEX: &str = "model_weights_v1";
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct ModelWeightDocument {
|
||||
pub token: ModelWeightToken,
|
||||
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub maybe_cover_image_media_file_token: Option<MediaFileToken>,
|
||||
pub maybe_cover_image_media_bucket_path: Option<String>,
|
||||
|
||||
//pub description_markdown: String,
|
||||
//pub description_markdown_html: String,
|
||||
|
||||
// TODO(bt,2023-12-22): Populate these fields
|
||||
//pub cached_user_ratings_total_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub cached_user_ratings_ratio: f32,
|
||||
//pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
pub creator_display_name: String,
|
||||
pub creator_gravatar_hash: String,
|
||||
|
||||
// Fields only used for TTS models and voice conversion models.
|
||||
pub maybe_ietf_language_tag: Option<String>,
|
||||
pub maybe_ietf_primary_language_subtag: Option<String>,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
impl Document for ModelWeightDocument {
|
||||
fn get_document_id(&self) -> String {
|
||||
self.token.to_string()
|
||||
}
|
||||
|
||||
fn get_document_path(&self) -> PathBuf {
|
||||
let document_id = self.get_document_id();
|
||||
PathBuf::from(format!("/{MODEL_WEIGHT_INDEX}/_doc/{document_id}"))
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ path = "src/lib.rs"
|
||||
my-workspace-hack = { version = "0.1", path = "../../../my-workspace-hack" }
|
||||
|
||||
# External
|
||||
infer = "0.11" # Mimetype detection
|
||||
infer = "0.15.0" # Mimetype detection
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -4,16 +4,23 @@
|
||||
pub fn mimetype_to_extension(mimetype: &str) -> Option<&'static str> {
|
||||
// TODO(bt,2023-11-17): maybe make a bidirectional map
|
||||
match mimetype {
|
||||
// Image
|
||||
"image/gif" => Some("gif"),
|
||||
"image/jpeg" => Some("jpg"),
|
||||
"image/png" => Some("png"),
|
||||
"image/webp" => Some("webp"),
|
||||
// Audio
|
||||
"audio/aac" => Some("aac"),
|
||||
"audio/m4a" => Some("m4a"),
|
||||
"audio/mpeg" => Some("mp3"),
|
||||
"audio/ogg" => Some("ogg"),
|
||||
"audio/opus" => Some("opus"),
|
||||
"audio/x-flac" => Some("flac"),
|
||||
"audio/wav" => Some("wav"),
|
||||
"audio/x-flac" => Some("flac"),
|
||||
"audio/x-wav" => Some("wav"),
|
||||
// Video
|
||||
"video/mp4" /* .mp4 */ => Some("mp4"),
|
||||
"video/quicktime" /* .mov */ => Some("mov"),
|
||||
"video/webm" => Some("webm"), // TODO: Browsers send this for audio?
|
||||
_ => None
|
||||
}
|
||||
@@ -35,5 +42,8 @@ mod test {
|
||||
assert_eq!(mimetype_to_extension("audio/mpeg"), Some("mp3"));
|
||||
assert_eq!(mimetype_to_extension("audio/wav"), Some("wav"));
|
||||
assert_eq!(mimetype_to_extension("audio/x-wav"), Some("wav"));
|
||||
assert_eq!(mimetype_to_extension("image/png"), Some("png"));
|
||||
assert_eq!(mimetype_to_extension("image/jpeg"), Some("jpg"));
|
||||
assert_eq!(mimetype_to_extension("video/mp4"), Some("mp4"));
|
||||
}
|
||||
}
|
||||
@@ -15,33 +15,33 @@ impl NoOpJobProgressReporterBuilder {
|
||||
}
|
||||
|
||||
impl JobProgressReporterBuilder for NoOpJobProgressReporterBuilder {
|
||||
fn new_generic_download(&self, job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
fn new_generic_download(&self, _job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
NoOpJobProgressReporterBuilder::create_instance()
|
||||
}
|
||||
|
||||
fn new_generic_inference(&self, job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
fn new_generic_inference(&self, _job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
NoOpJobProgressReporterBuilder::create_instance()
|
||||
}
|
||||
|
||||
fn new_tts_download(&self, tts_job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
fn new_tts_download(&self, _tts_job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
NoOpJobProgressReporterBuilder::create_instance()
|
||||
}
|
||||
|
||||
fn new_tts_inference(&self, tts_job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
fn new_tts_inference(&self, _tts_job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
NoOpJobProgressReporterBuilder::create_instance()
|
||||
}
|
||||
|
||||
fn new_w2l_download(&self, w2l_job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
fn new_w2l_download(&self, _w2l_job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
NoOpJobProgressReporterBuilder::create_instance()
|
||||
}
|
||||
|
||||
fn new_w2l_inference(&self, w2l_job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
fn new_w2l_inference(&self, _w2l_job_token: &str) -> AnyhowResult<Box<dyn JobProgressReporter>> {
|
||||
NoOpJobProgressReporterBuilder::create_instance()
|
||||
}
|
||||
}
|
||||
|
||||
impl JobProgressReporter for NoOpJobProgressReporter {
|
||||
fn log_status(&mut self, logging_details: &str) -> AnyhowResult<()> {
|
||||
fn log_status(&mut self, _logging_details: &str) -> AnyhowResult<()> {
|
||||
Ok(()) // No-op
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -39,4 +39,13 @@ impl UserRatingEntity {
|
||||
UserRatingEntity::W2lTemplate(token) => token.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_composite_keys(&self) -> (UserRatingEntityType, &str) {
|
||||
match self {
|
||||
UserRatingEntity::MediaFile(token) => (UserRatingEntityType::MediaFile, token.as_str()),
|
||||
UserRatingEntity::ModelWeight(token) => (UserRatingEntityType::ModelWeight, token.as_str()),
|
||||
UserRatingEntity::TtsModel(token) => (UserRatingEntityType::TtsModel, token.as_str()),
|
||||
UserRatingEntity::W2lTemplate(token) => (UserRatingEntityType::W2lTemplate, token.as_str()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ SET
|
||||
// NB: MySQL Error Code 1062: Duplicate key insertion (this is harder to access)
|
||||
match err {
|
||||
Database(err) => {
|
||||
let maybe_code = err.code().map(|c| c.into_owned());
|
||||
let _maybe_code = err.code().map(|c| c.into_owned());
|
||||
/*match maybe_code.as_deref() {
|
||||
Some("23000") => {
|
||||
if err.message().contains("username") {
|
||||
|
||||
@@ -346,7 +346,7 @@ SET
|
||||
// NB: MySQL Error Code 1062: Duplicate key insertion (this is harder to access)
|
||||
match err {
|
||||
Database(err) => {
|
||||
let maybe_code = err.code().map(|c| c.into_owned());
|
||||
let _maybe_code = err.code().map(|c| c.into_owned());
|
||||
/*match maybe_code.as_deref() {
|
||||
Some("23000") => {
|
||||
if err.message().contains("username") {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod stats_entity_token;
|
||||
pub mod upsert_entity_stats_on_bookmark_event;
|
||||
@@ -0,0 +1,39 @@
|
||||
use enums::by_table::entity_stats::stats_entity_type::StatsEntityType;
|
||||
use enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType;
|
||||
use tokens::tokens::comments::CommentToken;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
pub enum StatsEntityToken {
|
||||
Comment(CommentToken),
|
||||
MediaFile(MediaFileToken),
|
||||
ModelWeight(ModelWeightToken),
|
||||
}
|
||||
|
||||
impl StatsEntityToken {
|
||||
|
||||
/// Bookmark entity types aren't 1:1, and they're not a superset (yet) either.
|
||||
pub fn from_bookmark_entity_type_and_token(entity_type: UserBookmarkEntityType, token: &str) -> Option<Self> {
|
||||
match entity_type {
|
||||
UserBookmarkEntityType::MediaFile => Some(Self::MediaFile(MediaFileToken::new_from_str(token))),
|
||||
UserBookmarkEntityType::ModelWeight => Some(Self::ModelWeight(ModelWeightToken::new_from_str(token))),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_entity_type_and_token(entity_type: StatsEntityType, token: &str) -> Self {
|
||||
match entity_type {
|
||||
StatsEntityType::Comment => Self::Comment(CommentToken::new_from_str(token)),
|
||||
StatsEntityType::MediaFile => Self::MediaFile(MediaFileToken::new_from_str(token)),
|
||||
StatsEntityType::ModelWeight => Self::ModelWeight(ModelWeightToken::new_from_str(token)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_composite_keys(&self) -> (StatsEntityType, &str) {
|
||||
match self {
|
||||
StatsEntityToken::Comment(comment_token) => (StatsEntityType::Comment, comment_token.as_str()),
|
||||
StatsEntityToken::MediaFile(media_file_token) => (StatsEntityType::MediaFile, media_file_token.as_str()),
|
||||
StatsEntityToken::ModelWeight(model_weight_token) => (StatsEntityType::ModelWeight, model_weight_token.as_str()),
|
||||
}
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use sqlx::{Executor, MySql};
|
||||
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::queries::entity_stats::stats_entity_token::StatsEntityToken;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum BookmarkAction {
|
||||
Add,
|
||||
Delete,
|
||||
}
|
||||
|
||||
pub struct UpsertEntityStatsArgs<'e, 'c, E>
|
||||
where E: 'e + Executor<'c, Database = MySql>
|
||||
{
|
||||
pub stats_entity_token: &'e StatsEntityToken,
|
||||
pub action: BookmarkAction,
|
||||
pub mysql_executor: E,
|
||||
|
||||
// TODO: Not sure if this works to tell the compiler we need the lifetime annotation.
|
||||
// See: https://doc.rust-lang.org/std/marker/struct.PhantomData.html#unused-lifetime-parameters
|
||||
pub phantom: PhantomData<&'c E>,
|
||||
}
|
||||
|
||||
pub async fn upsert_entity_stats_on_bookmark_event<'e, 'c : 'e, E>(
|
||||
args: UpsertEntityStatsArgs<'e, 'c, E>,
|
||||
) -> AnyhowResult<()>
|
||||
where E: 'e + Executor<'c, Database = MySql>
|
||||
{
|
||||
let (entity_type, entity_token) = args.stats_entity_token.get_composite_keys();
|
||||
|
||||
let query = match args.action {
|
||||
BookmarkAction::Add => {
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO entity_stats SET
|
||||
entity_type = ?,
|
||||
entity_token = ?,
|
||||
bookmark_count = 1
|
||||
ON DUPLICATE KEY UPDATE
|
||||
bookmark_count = bookmark_count + 1
|
||||
"#,
|
||||
entity_type,
|
||||
entity_token,
|
||||
)
|
||||
}
|
||||
BookmarkAction::Delete => {
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO entity_stats SET
|
||||
entity_type = ?,
|
||||
entity_token = ?,
|
||||
bookmark_count = 0
|
||||
ON DUPLICATE KEY UPDATE
|
||||
bookmark_count = ABS(CAST(bookmark_count AS SIGNED) - 1)
|
||||
"#,
|
||||
entity_type,
|
||||
entity_token,
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
let query_result = query.execute(args.mysql_executor).await;
|
||||
|
||||
let _record_id = match query_result {
|
||||
Ok(res) => res.last_insert_id(),
|
||||
Err(err) => return Err(anyhow!("Mysql error: {:?}", err)),
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
-4
@@ -63,10 +63,6 @@ pub async fn insert_media_file_from_face_animation(
|
||||
maybe_creator_category_synthetic_id = Some(next_lipsync_id);
|
||||
}
|
||||
|
||||
let vc_model_token = args.job.maybe_model_token.as_deref();
|
||||
let creator_ip_address = args.job.creator_ip_address.as_str();
|
||||
let creator_set_visibility = args.job.creator_set_visibility.clone();
|
||||
|
||||
const ORIGIN_CATEGORY : MediaFileOriginCategory = MediaFileOriginCategory::Inference;
|
||||
const ORIGIN_PRODUCT_CATEGORY : MediaFileOriginProductCategory = MediaFileOriginProductCategory::FaceAnimator;
|
||||
const ORIGIN_MODEL_TYPE : MediaFileOriginModelType = MediaFileOriginModelType::SadTalker;
|
||||
|
||||
-3
@@ -63,9 +63,6 @@ pub async fn insert_media_file_from_rerender(
|
||||
maybe_creator_category_synthetic_id = Some(next_rerender_id);
|
||||
}
|
||||
|
||||
let creator_ip_address = args.job.creator_ip_address.as_str();
|
||||
let creator_set_visibility = args.job.creator_set_visibility.clone();
|
||||
|
||||
const ORIGIN_CATEGORY : MediaFileOriginCategory = MediaFileOriginCategory::Inference;
|
||||
const ORIGIN_PRODUCT_CATEGORY : MediaFileOriginProductCategory = MediaFileOriginProductCategory::VideoFilter;
|
||||
const ORIGIN_MODEL_TYPE : MediaFileOriginModelType = MediaFileOriginModelType::Rerender;
|
||||
|
||||
-4
@@ -67,10 +67,6 @@ pub async fn insert_media_file_from_tacotron2(
|
||||
maybe_creator_category_synthetic_id = Some(next_voice_conversion_id);
|
||||
}
|
||||
|
||||
let vc_model_token = args.job.maybe_model_token.as_deref();
|
||||
let creator_ip_address = args.job.creator_ip_address.as_str();
|
||||
let creator_set_visibility = args.job.creator_set_visibility.clone();
|
||||
|
||||
const ORIGIN_CATEGORY : MediaFileOriginCategory = MediaFileOriginCategory::Inference;
|
||||
const ORIGIN_PRODUCT_CATEGORY : MediaFileOriginProductCategory = MediaFileOriginProductCategory::TextToSpeech;
|
||||
const MEDIA_TYPE : MediaFileType = MediaFileType::Audio;
|
||||
|
||||
-4
@@ -76,10 +76,6 @@ pub async fn insert_media_file_from_voice_conversion(
|
||||
maybe_creator_category_synthetic_id = Some(next_voice_conversion_id);
|
||||
}
|
||||
|
||||
let vc_model_token = args.job.maybe_model_token.as_deref();
|
||||
let creator_ip_address = args.job.creator_ip_address.as_str();
|
||||
let creator_set_visibility = args.job.creator_set_visibility.clone();
|
||||
|
||||
const ORIGIN_CATEGORY : MediaFileOriginCategory = MediaFileOriginCategory::Inference;
|
||||
const ORIGIN_PRODUCT_CATEGORY : MediaFileOriginProductCategory = MediaFileOriginProductCategory::VoiceConversion;
|
||||
const MEDIA_TYPE : MediaFileType = MediaFileType::Audio;
|
||||
|
||||
@@ -8,9 +8,12 @@ use chrono::{DateTime, Utc};
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
@@ -31,6 +34,20 @@ pub struct MediaFile {
|
||||
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub maybe_model_weights_token: Option<ModelWeightToken>,
|
||||
pub maybe_model_weights_title: Option<String>,
|
||||
pub maybe_model_weights_type: Option<WeightsType>,
|
||||
pub maybe_model_weights_category: Option<WeightsCategory>,
|
||||
|
||||
pub maybe_model_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_model_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_model_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_model_weight_creator_user_token: Option<UserToken>,
|
||||
pub maybe_model_weight_creator_username: Option<String>,
|
||||
pub maybe_model_weight_creator_display_name: Option<String>,
|
||||
pub maybe_model_weight_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub public_bucket_directory_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
@@ -68,6 +85,20 @@ pub struct MediaFileRaw {
|
||||
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub maybe_model_weights_token: Option<ModelWeightToken>,
|
||||
pub maybe_model_weights_title: Option<String>,
|
||||
pub maybe_model_weights_type: Option<WeightsType>,
|
||||
pub maybe_model_weights_category: Option<WeightsCategory>,
|
||||
|
||||
pub maybe_model_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_model_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_model_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_model_weight_creator_user_token: Option<UserToken>,
|
||||
pub maybe_model_weight_creator_username: Option<String>,
|
||||
pub maybe_model_weight_creator_display_name: Option<String>,
|
||||
pub maybe_model_weight_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub public_bucket_directory_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
@@ -109,6 +140,17 @@ pub async fn get_media_file(
|
||||
maybe_creator_display_name: record.maybe_creator_display_name,
|
||||
maybe_creator_gravatar_hash: record.maybe_creator_gravatar_hash,
|
||||
creator_set_visibility: record.creator_set_visibility,
|
||||
maybe_model_weights_token: record.maybe_model_weights_token,
|
||||
maybe_model_weights_title: record.maybe_model_weights_title,
|
||||
maybe_model_weights_type: record.maybe_model_weights_type,
|
||||
maybe_model_weights_category: record.maybe_model_weights_category,
|
||||
maybe_model_cover_image_public_bucket_hash: record.maybe_model_cover_image_public_bucket_hash,
|
||||
maybe_model_cover_image_public_bucket_prefix: record.maybe_model_cover_image_public_bucket_prefix,
|
||||
maybe_model_cover_image_public_bucket_extension: record.maybe_model_cover_image_public_bucket_extension,
|
||||
maybe_model_weight_creator_user_token: record.maybe_model_weight_creator_user_token,
|
||||
maybe_model_weight_creator_username: record.maybe_model_weight_creator_username,
|
||||
maybe_model_weight_creator_display_name: record.maybe_model_weight_creator_display_name,
|
||||
maybe_model_weight_creator_gravatar_hash: record.maybe_model_weight_creator_gravatar_hash,
|
||||
public_bucket_directory_hash: record.public_bucket_directory_hash,
|
||||
maybe_public_bucket_prefix: record.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: record.maybe_public_bucket_extension,
|
||||
@@ -136,6 +178,20 @@ SELECT
|
||||
|
||||
m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
model_weights.token as `maybe_model_weights_token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
model_weights.title as maybe_model_weights_title,
|
||||
model_weights.weights_type as `maybe_model_weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
model_weights.weights_category as `maybe_model_weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
|
||||
cover_image.public_bucket_directory_hash as maybe_model_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_model_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_model_cover_image_public_bucket_extension,
|
||||
|
||||
model_weight_creator.token as `maybe_model_weight_creator_user_token: tokens::tokens::users::UserToken`,
|
||||
model_weight_creator.username as maybe_model_weight_creator_username,
|
||||
model_weight_creator.display_name as maybe_model_weight_creator_display_name,
|
||||
model_weight_creator.email_gravatar_hash as maybe_model_weight_creator_gravatar_hash,
|
||||
|
||||
m.public_bucket_directory_hash,
|
||||
m.maybe_public_bucket_prefix,
|
||||
m.maybe_public_bucket_extension,
|
||||
@@ -146,6 +202,12 @@ SELECT
|
||||
FROM media_files AS m
|
||||
LEFT OUTER JOIN users
|
||||
ON m.maybe_creator_user_token = users.token
|
||||
LEFT OUTER JOIN model_weights
|
||||
ON m.maybe_origin_model_token = model_weights.token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = model_weights.maybe_cover_image_media_file_token
|
||||
LEFT OUTER JOIN users as model_weight_creator
|
||||
ON model_weight_creator.token = model_weights.creator_user_token
|
||||
WHERE
|
||||
m.token = ?
|
||||
"#,
|
||||
@@ -174,6 +236,20 @@ SELECT
|
||||
|
||||
m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
model_weights.token as `maybe_model_weights_token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
model_weights.title as maybe_model_weights_title,
|
||||
model_weights.weights_type as `maybe_model_weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
model_weights.weights_category as `maybe_model_weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
|
||||
cover_image.public_bucket_directory_hash as maybe_model_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_model_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_model_cover_image_public_bucket_extension,
|
||||
|
||||
model_weight_creator.token as `maybe_model_weight_creator_user_token: tokens::tokens::users::UserToken`,
|
||||
model_weight_creator.username as maybe_model_weight_creator_username,
|
||||
model_weight_creator.display_name as maybe_model_weight_creator_display_name,
|
||||
model_weight_creator.email_gravatar_hash as maybe_model_weight_creator_gravatar_hash,
|
||||
|
||||
m.public_bucket_directory_hash,
|
||||
m.maybe_public_bucket_prefix,
|
||||
m.maybe_public_bucket_extension,
|
||||
@@ -184,6 +260,12 @@ SELECT
|
||||
FROM media_files AS m
|
||||
LEFT OUTER JOIN users
|
||||
ON m.maybe_creator_user_token = users.token
|
||||
LEFT OUTER JOIN model_weights
|
||||
ON m.maybe_origin_model_token = model_weights.token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = model_weights.maybe_cover_image_media_file_token
|
||||
LEFT OUTER JOIN users as model_weight_creator
|
||||
ON model_weight_creator.token = model_weights.creator_user_token
|
||||
WHERE
|
||||
m.token = ?
|
||||
AND m.user_deleted_at IS NULL
|
||||
|
||||
@@ -6,6 +6,7 @@ use enums::by_table::media_files::media_file_origin_category::MediaFileOriginCat
|
||||
use enums::by_table::media_files::media_file_origin_model_type::MediaFileOriginModelType;
|
||||
use enums::by_table::media_files::media_file_origin_product_category::MediaFileOriginProductCategory;
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::common::view_as::ViewAs;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums::traits::mysql_from_row::MySqlFromRow;
|
||||
use errors::AnyhowResult;
|
||||
@@ -51,17 +52,12 @@ pub struct MediaFileListItem {
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ViewAs {
|
||||
Moderator,
|
||||
NonModerator,
|
||||
}
|
||||
|
||||
pub struct ListMediaFilesArgs<'a> {
|
||||
pub limit: usize,
|
||||
pub maybe_filter_media_type: Option<MediaFileType>,
|
||||
pub maybe_offset: Option<usize>,
|
||||
pub cursor_is_reversed: bool,
|
||||
pub sort_ascending: bool,
|
||||
pub view_as: ViewAs,
|
||||
pub mysql_pool: &'a MySqlPool,
|
||||
}
|
||||
@@ -73,6 +69,7 @@ pub async fn list_media_files(args: ListMediaFilesArgs<'_>) -> AnyhowResult<Medi
|
||||
args.limit,
|
||||
args.maybe_offset,
|
||||
args.cursor_is_reversed,
|
||||
args.sort_ascending,
|
||||
args.view_as,
|
||||
);
|
||||
|
||||
@@ -124,9 +121,11 @@ fn query_builder<'a>(
|
||||
limit: usize,
|
||||
maybe_offset: Option<usize>,
|
||||
cursor_is_reversed: bool,
|
||||
sort_ascending: bool,
|
||||
view_as: ViewAs,
|
||||
) -> QueryBuilder<'a, MySql> {
|
||||
|
||||
let mut sort_ascending = sort_ascending;
|
||||
// NB: Query cannot be statically checked by sqlx
|
||||
let mut query_builder: QueryBuilder<MySql> = QueryBuilder::new(
|
||||
r#"
|
||||
@@ -166,23 +165,35 @@ LEFT OUTER JOIN favorites as f
|
||||
ON f.entity_type = 'media_file' AND f.entity_token = m.token
|
||||
LEFT OUTER JOIN comments as c
|
||||
ON c.entity_type = 'media_file' AND c.entity_token = c.token
|
||||
WHERE
|
||||
m.user_deleted_at IS NULL
|
||||
AND m.mod_deleted_at IS NULL
|
||||
"#
|
||||
);
|
||||
|
||||
let mut first_predicate_added = false;
|
||||
|
||||
if let Some(media_type) = maybe_filter_media_type {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
// FIXME: Binding shouldn't require to_str().
|
||||
// Otherwise, it's calling the Display trait on the raw type which is resulting in an
|
||||
// incorrect binding and runtime error.
|
||||
query_builder.push(" AND m.media_file_type = ");
|
||||
query_builder.push(" m.media_type = ");
|
||||
query_builder.push_bind(media_type.to_str());
|
||||
}
|
||||
|
||||
match view_as {
|
||||
ViewAs::Moderator => {}
|
||||
ViewAs::NonModerator=> {
|
||||
ViewAs::Author | ViewAs::AnotherUser => {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
query_builder.push(" m.user_deleted_at IS NULL AND m.mod_deleted_at IS NULL ");
|
||||
// FIXME: Binding shouldn't require to_str().
|
||||
// Otherwise, it's calling the Display trait on the raw type which is resulting in an
|
||||
// incorrect binding and runtime error.
|
||||
@@ -192,17 +203,36 @@ WHERE
|
||||
}
|
||||
|
||||
if let Some(offset) = maybe_offset {
|
||||
if cursor_is_reversed {
|
||||
query_builder.push(format!(" AND m.id < {offset} "));
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(format!(" AND m.id > {offset} "));
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
|
||||
if sort_ascending {
|
||||
if cursor_is_reversed {
|
||||
// NB: We're searching backwards.
|
||||
query_builder.push(" m.id < ");
|
||||
sort_ascending = !sort_ascending;
|
||||
} else {
|
||||
query_builder.push(" m.id > ");
|
||||
}
|
||||
} else {
|
||||
if cursor_is_reversed {
|
||||
// NB: We're searching backwards.
|
||||
query_builder.push(" m.id > ");
|
||||
sort_ascending = !sort_ascending;
|
||||
} else {
|
||||
query_builder.push(" m.id < ");
|
||||
}
|
||||
}
|
||||
query_builder.push_bind(offset as i64);
|
||||
}
|
||||
|
||||
query_builder.push(" GROUP BY m.id ");
|
||||
|
||||
query_builder.push(" GROUP BY m.id");
|
||||
|
||||
if cursor_is_reversed {
|
||||
if sort_ascending {
|
||||
query_builder.push(" ORDER BY m.id ASC ");
|
||||
} else {
|
||||
query_builder.push(" ORDER BY m.id DESC ");
|
||||
|
||||
@@ -6,6 +6,7 @@ use enums::by_table::media_files::media_file_origin_category::MediaFileOriginCat
|
||||
use enums::by_table::media_files::media_file_origin_model_type::MediaFileOriginModelType;
|
||||
use enums::by_table::media_files::media_file_origin_product_category::MediaFileOriginProductCategory;
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::common::view_as::ViewAs;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums::traits::mysql_from_row::MySqlFromRow;
|
||||
use errors::AnyhowResult;
|
||||
@@ -39,12 +40,6 @@ pub struct MediaFileListItem {
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ViewAs {
|
||||
Author,
|
||||
Moderator,
|
||||
AnotherUser,
|
||||
}
|
||||
|
||||
pub struct ListMediaFileForUserArgs<'a> {
|
||||
pub username: &'a str,
|
||||
@@ -168,27 +163,27 @@ SELECT
|
||||
FROM media_files AS m
|
||||
LEFT OUTER JOIN users AS u
|
||||
ON m.maybe_creator_user_token = u.token
|
||||
|
||||
WHERE m.user_deleted_at IS NULL
|
||||
AND m.mod_deleted_at IS NULL
|
||||
"#
|
||||
));
|
||||
|
||||
query_builder.push(" AND u.username = ");
|
||||
query_builder.push(" WHERE u.username = ");
|
||||
query_builder.push_bind(username);
|
||||
|
||||
if let Some(media_type) = maybe_filter_media_type {
|
||||
// FIXME: Binding shouldn't require to_str().
|
||||
// Otherwise, it's calling the Display trait on the raw type which is resulting in an
|
||||
// incorrect binding and runtime error.
|
||||
query_builder.push(" AND m.media_file_type = ");
|
||||
query_builder.push(" AND m.media_type = ");
|
||||
query_builder.push_bind(media_type.to_str());
|
||||
}
|
||||
|
||||
match view_as {
|
||||
ViewAs::Author => {}
|
||||
ViewAs::Author => {
|
||||
query_builder.push(" AND m.user_deleted_at IS NULL AND m.mod_deleted_at IS NULL ");
|
||||
}
|
||||
ViewAs::Moderator => {}
|
||||
ViewAs::AnotherUser => {
|
||||
query_builder.push(" AND m.user_deleted_at IS NULL AND m.mod_deleted_at IS NULL ");
|
||||
// FIXME: Binding shouldn't require to_str().
|
||||
// Otherwise, it's calling the Display trait on the raw type which is resulting in an
|
||||
// incorrect binding and runtime error.
|
||||
|
||||
@@ -3,6 +3,7 @@ pub mod audit_logs;
|
||||
pub mod billing;
|
||||
pub mod comments;
|
||||
pub mod email_sender_jobs;
|
||||
pub mod entity_stats;
|
||||
pub mod generic_download;
|
||||
pub mod generic_inference;
|
||||
pub mod generic_synthetic_ids;
|
||||
@@ -11,18 +12,18 @@ pub mod ip_bans;
|
||||
pub mod media_files;
|
||||
pub mod media_uploads;
|
||||
pub mod model_categories;
|
||||
pub mod model_weights;
|
||||
pub mod public_event_feed;
|
||||
pub mod stats;
|
||||
pub mod trending_model_analytics;
|
||||
pub mod tts;
|
||||
pub mod twitch;
|
||||
pub mod users;
|
||||
pub mod user_bookmarks;
|
||||
pub mod users;
|
||||
pub mod vocoder;
|
||||
pub mod voice_clone_requests;
|
||||
pub mod voice_conversion;
|
||||
pub mod voice_designer;
|
||||
pub mod w2l;
|
||||
pub mod model_weights;
|
||||
|
||||
|
||||
|
||||
+3
-11
@@ -63,11 +63,9 @@ SET
|
||||
weights_category = ?,
|
||||
title = ?,
|
||||
|
||||
maybe_thumbnail_token = NULL,
|
||||
maybe_avatar_media_file_token = NULL,
|
||||
maybe_cover_media_file_token = NULL,
|
||||
description_markdown = NULL,
|
||||
description_rendered_html = NULL,
|
||||
maybe_cover_image_media_file_token = NULL,
|
||||
maybe_description_markdown = NULL,
|
||||
maybe_description_rendered_html = NULL,
|
||||
|
||||
maybe_last_update_user_token = NULL,
|
||||
original_download_url = ?,
|
||||
@@ -83,12 +81,6 @@ SET
|
||||
maybe_public_bucket_prefix = ?,
|
||||
maybe_public_bucket_extension = ?,
|
||||
|
||||
cached_user_ratings_total_count = 0,
|
||||
cached_user_ratings_positive_count = 0,
|
||||
cached_user_ratings_negative_count = 0,
|
||||
maybe_cached_user_ratings_ratio = 0.0,
|
||||
cached_user_ratings_last_updated_at = NOW(),
|
||||
|
||||
maybe_migration_old_model_token = ?
|
||||
"#,
|
||||
&weights_token,
|
||||
|
||||
@@ -13,9 +13,8 @@ pub struct CreateModelWeightsArgs<'a> {
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub title: String,
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
pub creator_user_token: Option<&'a UserToken>,
|
||||
pub creator_ip_address: &'a str,
|
||||
pub creator_set_visibility: Visibility,
|
||||
@@ -27,10 +26,10 @@ pub struct CreateModelWeightsArgs<'a> {
|
||||
pub public_bucket_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
pub cached_user_ratings_negative_count: u32,
|
||||
pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
//pub cached_user_ratings_total_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
pub version: i32,
|
||||
pub mysql_pool: &'a MySqlPool,
|
||||
}
|
||||
@@ -47,9 +46,8 @@ pub async fn create_weight(args: CreateModelWeightsArgs<'_>) -> AnyhowResult<Mod
|
||||
weights_type = ?,
|
||||
weights_category = ?,
|
||||
title = ?,
|
||||
maybe_thumbnail_token = ?,
|
||||
description_markdown = ?,
|
||||
description_rendered_html = ?,
|
||||
maybe_description_markdown = ?,
|
||||
maybe_description_rendered_html = ?,
|
||||
creator_user_token = ?,
|
||||
creator_ip_address = ?,
|
||||
creator_set_visibility = ?,
|
||||
@@ -61,19 +59,14 @@ pub async fn create_weight(args: CreateModelWeightsArgs<'_>) -> AnyhowResult<Mod
|
||||
public_bucket_hash = ?,
|
||||
maybe_public_bucket_prefix = ?,
|
||||
maybe_public_bucket_extension = ?,
|
||||
cached_user_ratings_total_count = ?,
|
||||
cached_user_ratings_positive_count = ?,
|
||||
cached_user_ratings_negative_count = ?,
|
||||
maybe_cached_user_ratings_ratio = ?,
|
||||
version = ?
|
||||
"#,
|
||||
args.token.as_str(),
|
||||
args.weights_type.to_str(),
|
||||
args.weights_category.to_str(),
|
||||
args.title,
|
||||
args.maybe_thumbnail_token,
|
||||
args.description_markdown,
|
||||
args.description_rendered_html,
|
||||
args.maybe_description_markdown,
|
||||
args.maybe_description_rendered_html,
|
||||
args.creator_user_token.as_deref(),
|
||||
args.creator_ip_address,
|
||||
args.creator_set_visibility.to_str(),
|
||||
@@ -85,10 +78,10 @@ pub async fn create_weight(args: CreateModelWeightsArgs<'_>) -> AnyhowResult<Mod
|
||||
args.public_bucket_hash,
|
||||
args.maybe_public_bucket_prefix,
|
||||
args.maybe_public_bucket_extension,
|
||||
args.cached_user_ratings_total_count,
|
||||
args.cached_user_ratings_positive_count,
|
||||
args.cached_user_ratings_negative_count,
|
||||
args.maybe_cached_user_ratings_ratio,
|
||||
//args.cached_user_ratings_total_count,
|
||||
//args.cached_user_ratings_positive_count,
|
||||
//args.cached_user_ratings_negative_count,
|
||||
//args.maybe_cached_user_ratings_ratio,
|
||||
args.version
|
||||
)
|
||||
.execute(args.mysql_pool).await;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
pub mod set_model_weight_avatar;
|
||||
pub mod set_model_weight_cover_image;
|
||||
pub mod update_weight;
|
||||
|
||||
+6
-6
@@ -6,25 +6,25 @@ use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
pub struct UpdateArgs<'a> {
|
||||
pub model_weight_token: &'a ModelWeightToken,
|
||||
pub maybe_avatar_media_file_token: Option<&'a MediaFileToken>,
|
||||
pub maybe_cover_image_media_file_token: Option<&'a MediaFileToken>,
|
||||
//pub update_ip_address: &'a str,
|
||||
pub mysql_pool: &'a MySqlPool
|
||||
}
|
||||
|
||||
pub async fn set_model_weight_avatar(args: UpdateArgs<'_>) -> AnyhowResult<()>{
|
||||
pub async fn set_model_weight_cover_image(args: UpdateArgs<'_>) -> AnyhowResult<()>{
|
||||
let transaction = args.mysql_pool.begin().await?;
|
||||
|
||||
let query_result = sqlx::query!(
|
||||
let _query_result = sqlx::query!(
|
||||
r#"
|
||||
UPDATE model_weights
|
||||
SET
|
||||
maybe_avatar_media_file_token = ?
|
||||
maybe_cover_image_media_file_token = ?
|
||||
WHERE token = ?
|
||||
LIMIT 1
|
||||
"#,
|
||||
args.maybe_avatar_media_file_token,
|
||||
args.maybe_cover_image_media_file_token,
|
||||
args.model_weight_token,
|
||||
).execute(args.mysql_pool).await;
|
||||
).execute(args.mysql_pool).await?;
|
||||
|
||||
transaction.commit().await?;
|
||||
|
||||
@@ -1,53 +1,87 @@
|
||||
use anyhow::anyhow;
|
||||
use sqlx::MySqlPool;
|
||||
use sqlx::{MySql, MySqlPool, QueryBuilder};
|
||||
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
pub struct UpdateWeightArgs<'a> {
|
||||
pub weight_token: &'a ModelWeightToken,
|
||||
pub title: Option<&'a str>,
|
||||
pub maybe_thumbnail_token: Option<&'a str>,
|
||||
pub description_markdown: Option<&'a str>,
|
||||
pub description_rendered_html: Option<&'a str>,
|
||||
pub cover_image: Option<CoverImageOption<'a>>,
|
||||
pub maybe_description_markdown: Option<&'a str>,
|
||||
pub maybe_description_rendered_html: Option<&'a str>,
|
||||
pub creator_set_visibility: Option<&'a Visibility>,
|
||||
pub weights_type: Option<String>,
|
||||
pub weights_category: Option<String>,
|
||||
pub mysql_pool: &'a MySqlPool,
|
||||
}
|
||||
|
||||
pub enum CoverImageOption<'a> {
|
||||
ClearCoverImage,
|
||||
SetCoverImage(&'a MediaFileToken),
|
||||
}
|
||||
|
||||
pub async fn update_weights(args: UpdateWeightArgs<'_>) -> AnyhowResult<()> {
|
||||
let transaction = args.mysql_pool.begin().await?;
|
||||
if args.title.is_none()
|
||||
&& args.maybe_description_markdown.is_none()
|
||||
&& args.maybe_description_rendered_html.is_none()
|
||||
&& args.creator_set_visibility.is_none()
|
||||
&& args.cover_image.is_none()
|
||||
{
|
||||
return Err(anyhow!("No fields to update"));
|
||||
}
|
||||
|
||||
|
||||
let query_result = sqlx::query!(
|
||||
let mut query_builder: QueryBuilder<MySql> = QueryBuilder::new(
|
||||
r#"
|
||||
UPDATE model_weights
|
||||
SET
|
||||
title = COALESCE(?, title),
|
||||
description_markdown = COALESCE(?, description_markdown),
|
||||
maybe_thumbnail_token = COALESCE(?, maybe_thumbnail_token),
|
||||
description_rendered_html = COALESCE(?, description_rendered_html),
|
||||
creator_set_visibility = COALESCE(?, creator_set_visibility),
|
||||
version = version + 1
|
||||
WHERE token = ?
|
||||
"#,
|
||||
args.title.as_deref(),
|
||||
args.description_markdown.as_deref(),
|
||||
args.maybe_thumbnail_token.as_deref(),
|
||||
args.description_rendered_html.as_deref(),
|
||||
args.creator_set_visibility.as_deref(),
|
||||
args.weight_token.as_str()
|
||||
)
|
||||
.execute(args.mysql_pool).await;
|
||||
UPDATE model_weights
|
||||
SET
|
||||
"#
|
||||
);
|
||||
|
||||
let mut separated = query_builder.separated(", ");
|
||||
|
||||
if let Some(title) = args.title {
|
||||
separated.push("title = ");
|
||||
separated.push_bind_unseparated(title);
|
||||
}
|
||||
if let Some(maybe_description_markdown) = args.maybe_description_markdown {
|
||||
separated.push("maybe_description_markdown = ");
|
||||
separated.push_bind_unseparated(maybe_description_markdown);
|
||||
}
|
||||
if let Some(maybe_description_rendered_html) = args.maybe_description_rendered_html {
|
||||
separated.push("maybe_description_rendered_html = ");
|
||||
separated.push_bind_unseparated(maybe_description_rendered_html);
|
||||
}
|
||||
if let Some(creator_set_visibility) = args.creator_set_visibility {
|
||||
separated.push("creator_set_visibility = ");
|
||||
separated.push_bind_unseparated(creator_set_visibility.to_str());
|
||||
}
|
||||
if let Some(cover_image_option) = args.cover_image {
|
||||
match cover_image_option {
|
||||
CoverImageOption::ClearCoverImage => {
|
||||
separated.push(" maybe_cover_image_media_file_token = NULL ");
|
||||
}
|
||||
CoverImageOption::SetCoverImage(media_file_token) => {
|
||||
separated.push("maybe_cover_image_media_file_token = ");
|
||||
separated.push_bind_unseparated(media_file_token.as_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
separated.push("version = version + 1");
|
||||
|
||||
separated.push_unseparated(" WHERE token = ");
|
||||
separated.push_bind_unseparated(args.weight_token.as_str());
|
||||
separated.push_unseparated(" LIMIT 1");
|
||||
|
||||
let transaction = args.mysql_pool.begin().await?;
|
||||
let query_result = query_builder.build().execute(args.mysql_pool).await;
|
||||
transaction.commit().await?;
|
||||
|
||||
match query_result {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => {
|
||||
Err(anyhow!("weights update error: {:?}", err))
|
||||
Err(anyhow!("weights update error: {:?}", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +96,7 @@ mod tests {
|
||||
use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
#[ignore]
|
||||
#[tokio::test]
|
||||
async fn test_update_weights() -> AnyhowResult<()> {
|
||||
let db_connection_string = DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
|
||||
@@ -19,9 +19,8 @@ pub struct RetrievedModelWeight {
|
||||
pub title: String,
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
@@ -40,15 +39,16 @@ pub struct RetrievedModelWeight {
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_avatar_public_bucket_hash: Option<String>,
|
||||
pub maybe_avatar_public_bucket_prefix: Option<String>,
|
||||
pub maybe_avatar_public_bucket_extension: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_total_count: u32,
|
||||
//pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
//pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
|
||||
pub cached_user_ratings_negative_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
pub version: i32,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
@@ -95,9 +95,8 @@ pub async fn get_weights_by_token_with_connection(
|
||||
title: record.title,
|
||||
weights_type: record.weights_type,
|
||||
weights_category: record.weights_category,
|
||||
maybe_thumbnail_token: record.maybe_thumbnail_token,
|
||||
description_markdown: record.description_markdown,
|
||||
description_rendered_html: record.description_rendered_html,
|
||||
maybe_description_markdown: record.maybe_description_markdown,
|
||||
maybe_description_rendered_html: record.maybe_description_rendered_html,
|
||||
creator_user_token: record.creator_user_token,
|
||||
creator_username: record.creator_username,
|
||||
creator_display_name: record.creator_display_name,
|
||||
@@ -112,14 +111,14 @@ pub async fn get_weights_by_token_with_connection(
|
||||
public_bucket_hash: record.public_bucket_hash,
|
||||
maybe_public_bucket_prefix: record.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: record.maybe_public_bucket_extension,
|
||||
maybe_avatar_public_bucket_hash: record.maybe_avatar_public_bucket_hash,
|
||||
maybe_avatar_public_bucket_prefix: record.maybe_avatar_public_bucket_prefix,
|
||||
maybe_avatar_public_bucket_extension: record.maybe_avatar_public_bucket_extension,
|
||||
cached_user_ratings_negative_count: record.cached_user_ratings_negative_count,
|
||||
cached_user_ratings_positive_count: record.cached_user_ratings_positive_count,
|
||||
cached_user_ratings_total_count: record.cached_user_ratings_total_count,
|
||||
maybe_cached_user_ratings_ratio: record.maybe_cached_user_ratings_ratio,
|
||||
cached_user_ratings_last_updated_at: record.cached_user_ratings_last_updated_at,
|
||||
maybe_cover_image_public_bucket_hash: record.maybe_cover_image_public_bucket_hash,
|
||||
maybe_cover_image_public_bucket_prefix: record.maybe_cover_image_public_bucket_prefix,
|
||||
maybe_cover_image_public_bucket_extension: record.maybe_cover_image_public_bucket_extension,
|
||||
//cached_user_ratings_negative_count: record.cached_user_ratings_negative_count,
|
||||
//cached_user_ratings_positive_count: record.cached_user_ratings_positive_count,
|
||||
//cached_user_ratings_total_count: record.cached_user_ratings_total_count,
|
||||
//maybe_cached_user_ratings_ratio: record.maybe_cached_user_ratings_ratio,
|
||||
//cached_user_ratings_last_updated_at: record.cached_user_ratings_last_updated_at,
|
||||
version: record.version,
|
||||
created_at: record.created_at,
|
||||
updated_at: record.updated_at,
|
||||
@@ -142,9 +141,8 @@ async fn select_include_deleted(
|
||||
wt.title,
|
||||
wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
wt.maybe_thumbnail_token,
|
||||
wt.description_markdown,
|
||||
wt.description_rendered_html,
|
||||
wt.maybe_description_markdown,
|
||||
wt.maybe_description_rendered_html,
|
||||
|
||||
wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,
|
||||
users.username as creator_username,
|
||||
@@ -158,19 +156,15 @@ async fn select_include_deleted(
|
||||
wt.original_filename,
|
||||
wt.file_size_bytes,
|
||||
wt.file_checksum_sha2,
|
||||
|
||||
wt.public_bucket_hash,
|
||||
wt.maybe_public_bucket_prefix,
|
||||
wt.maybe_public_bucket_extension,
|
||||
|
||||
avatar.public_bucket_directory_hash as maybe_avatar_public_bucket_hash,
|
||||
avatar.maybe_public_bucket_prefix as maybe_avatar_public_bucket_prefix,
|
||||
avatar.maybe_public_bucket_extension as maybe_avatar_public_bucket_extension,
|
||||
cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,
|
||||
|
||||
wt.cached_user_ratings_negative_count,
|
||||
wt.cached_user_ratings_positive_count,
|
||||
wt.cached_user_ratings_total_count,
|
||||
wt.maybe_cached_user_ratings_ratio,
|
||||
wt.cached_user_ratings_last_updated_at,
|
||||
wt.version,
|
||||
wt.created_at,
|
||||
wt.updated_at,
|
||||
@@ -179,8 +173,8 @@ async fn select_include_deleted(
|
||||
FROM model_weights as wt
|
||||
JOIN users
|
||||
ON users.token = wt.creator_user_token
|
||||
LEFT OUTER JOIN media_files as avatar
|
||||
ON avatar.token = wt.maybe_avatar_media_file_token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = wt.maybe_cover_image_media_file_token
|
||||
WHERE
|
||||
wt.token = ?
|
||||
"#,
|
||||
@@ -204,9 +198,8 @@ async fn select_without_deleted(
|
||||
wt.title,
|
||||
wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
wt.maybe_thumbnail_token,
|
||||
wt.description_markdown,
|
||||
wt.description_rendered_html,
|
||||
wt.maybe_description_markdown,
|
||||
wt.maybe_description_rendered_html,
|
||||
wt.creator_ip_address,
|
||||
wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
|
||||
|
||||
@@ -224,15 +217,10 @@ async fn select_without_deleted(
|
||||
wt.maybe_public_bucket_prefix,
|
||||
wt.maybe_public_bucket_extension,
|
||||
|
||||
avatar.public_bucket_directory_hash as maybe_avatar_public_bucket_hash,
|
||||
avatar.maybe_public_bucket_prefix as maybe_avatar_public_bucket_prefix,
|
||||
avatar.maybe_public_bucket_extension as maybe_avatar_public_bucket_extension,
|
||||
cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,
|
||||
|
||||
wt.cached_user_ratings_negative_count,
|
||||
wt.cached_user_ratings_positive_count,
|
||||
wt.cached_user_ratings_total_count,
|
||||
wt.maybe_cached_user_ratings_ratio,
|
||||
wt.cached_user_ratings_last_updated_at,
|
||||
wt.version,
|
||||
wt.created_at,
|
||||
wt.updated_at,
|
||||
@@ -241,8 +229,8 @@ async fn select_without_deleted(
|
||||
FROM model_weights as wt
|
||||
JOIN users
|
||||
ON users.token = wt.creator_user_token
|
||||
LEFT OUTER JOIN media_files as avatar
|
||||
ON avatar.token = wt.maybe_avatar_media_file_token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = wt.maybe_cover_image_media_file_token
|
||||
WHERE
|
||||
wt.token = ?
|
||||
AND wt.user_deleted_at IS NULL
|
||||
@@ -260,9 +248,8 @@ pub struct RawWeight {
|
||||
pub title: String,
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
@@ -280,15 +267,16 @@ pub struct RawWeight {
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_avatar_public_bucket_hash: Option<String>,
|
||||
pub maybe_avatar_public_bucket_prefix: Option<String>,
|
||||
pub maybe_avatar_public_bucket_extension: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_total_count: u32,
|
||||
//pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
//pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
|
||||
pub cached_user_ratings_negative_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
pub version: i32,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
|
||||
@@ -20,8 +20,6 @@ pub struct WeightsByTokensRecord {
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
pub creator_display_name: String,
|
||||
@@ -31,11 +29,15 @@ pub struct WeightsByTokensRecord {
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
pub cached_user_ratings_negative_count: u32,
|
||||
pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
//pub cached_user_ratings_total_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
//pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
@@ -71,7 +73,6 @@ async fn get_raw_weights_by_tokens(
|
||||
mw.title,
|
||||
mw.weights_type,
|
||||
mw.weights_category,
|
||||
mw.maybe_thumbnail_token,
|
||||
users.token as creator_user_token,
|
||||
users.username as creator_username,
|
||||
users.display_name as creator_display_name,
|
||||
@@ -79,6 +80,9 @@ async fn get_raw_weights_by_tokens(
|
||||
mw.public_bucket_hash,
|
||||
mw.maybe_public_bucket_prefix,
|
||||
mw.maybe_public_bucket_extension,
|
||||
cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,
|
||||
mw.cached_user_ratings_negative_count,
|
||||
mw.cached_user_ratings_positive_count,
|
||||
mw.cached_user_ratings_total_count,
|
||||
@@ -91,6 +95,8 @@ async fn get_raw_weights_by_tokens(
|
||||
FROM model_weights as mw
|
||||
JOIN users
|
||||
ON users.token = mw.creator_user_token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = mw.maybe_cover_image_media_file_token
|
||||
WHERE
|
||||
mw.creator_set_visibility = "public"
|
||||
AND mw.token IN (
|
||||
@@ -104,7 +110,6 @@ async fn get_raw_weights_by_tokens(
|
||||
mw.title,
|
||||
mw.weights_type,
|
||||
mw.weights_category,
|
||||
mw.maybe_thumbnail_token,
|
||||
users.token as creator_user_token,
|
||||
users.username as creator_username,
|
||||
users.display_name as creator_display_name,
|
||||
@@ -112,6 +117,9 @@ async fn get_raw_weights_by_tokens(
|
||||
mw.public_bucket_hash,
|
||||
mw.maybe_public_bucket_prefix,
|
||||
mw.maybe_public_bucket_extension,
|
||||
cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,
|
||||
mw.cached_user_ratings_negative_count,
|
||||
mw.cached_user_ratings_positive_count,
|
||||
mw.cached_user_ratings_total_count,
|
||||
@@ -124,6 +132,8 @@ async fn get_raw_weights_by_tokens(
|
||||
FROM model_weights as mw
|
||||
JOIN users
|
||||
ON users.token = mw.creator_user_token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = mw.maybe_cover_image_media_file_token
|
||||
WHERE
|
||||
mw.creator_set_visibility = "public"
|
||||
AND mw.user_deleted_at IS NULL
|
||||
@@ -157,34 +167,36 @@ fn token_predicate(tokens: &[ModelWeightToken]) -> String {
|
||||
fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsByTokensRecord> {
|
||||
let weights: Vec<WeightsByTokensRecord> = dataset
|
||||
.into_iter()
|
||||
.map(|dataset: RawWeightJoinUser| {
|
||||
.map(|weight| {
|
||||
WeightsByTokensRecord {
|
||||
token: dataset.token,
|
||||
title: dataset.title,
|
||||
weights_type: dataset.weights_type,
|
||||
weights_category: dataset.weights_category,
|
||||
maybe_thumbnail_token: dataset.maybe_thumbnail_token,
|
||||
token: weight.token,
|
||||
title: weight.title,
|
||||
weights_type: weight.weights_type,
|
||||
weights_category: weight.weights_category,
|
||||
|
||||
creator_user_token: dataset.creator_user_token,
|
||||
creator_username:dataset.creator_username,
|
||||
creator_display_name:dataset.creator_display_name,
|
||||
creator_email_gravatar_hash:dataset.creator_email_gravatar_hash,
|
||||
creator_user_token: weight.creator_user_token,
|
||||
creator_username: weight.creator_username,
|
||||
creator_display_name: weight.creator_display_name,
|
||||
creator_email_gravatar_hash: weight.creator_email_gravatar_hash,
|
||||
|
||||
public_bucket_hash: dataset.public_bucket_hash,
|
||||
maybe_public_bucket_prefix: dataset.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: dataset.maybe_public_bucket_extension,
|
||||
public_bucket_hash: weight.public_bucket_hash,
|
||||
maybe_public_bucket_prefix: weight.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: weight.maybe_public_bucket_extension,
|
||||
|
||||
cached_user_ratings_negative_count: dataset.cached_user_ratings_negative_count,
|
||||
cached_user_ratings_positive_count: dataset.cached_user_ratings_positive_count,
|
||||
cached_user_ratings_total_count: dataset.cached_user_ratings_total_count,
|
||||
maybe_cover_image_public_bucket_hash: weight.maybe_cover_image_public_bucket_hash,
|
||||
maybe_cover_image_public_bucket_prefix: weight.maybe_cover_image_public_bucket_prefix,
|
||||
maybe_cover_image_public_bucket_extension: weight.maybe_cover_image_public_bucket_extension,
|
||||
|
||||
maybe_cached_user_ratings_ratio: dataset.maybe_cached_user_ratings_ratio,
|
||||
cached_user_ratings_last_updated_at: dataset.cached_user_ratings_last_updated_at,
|
||||
//cached_user_ratings_negative_count: weight.cached_user_ratings_negative_count,
|
||||
//cached_user_ratings_positive_count: weight.cached_user_ratings_positive_count,
|
||||
//cached_user_ratings_total_count: weight.cached_user_ratings_total_count,
|
||||
//maybe_cached_user_ratings_ratio: weight.maybe_cached_user_ratings_ratio,
|
||||
//cached_user_ratings_last_updated_at: weight.cached_user_ratings_last_updated_at,
|
||||
|
||||
created_at: dataset.created_at,
|
||||
updated_at: dataset.updated_at,
|
||||
user_deleted_at: dataset.user_deleted_at,
|
||||
mod_deleted_at: dataset.mod_deleted_at,
|
||||
created_at: weight.created_at,
|
||||
updated_at: weight.updated_at,
|
||||
user_deleted_at: weight.user_deleted_at,
|
||||
mod_deleted_at: weight.mod_deleted_at,
|
||||
}
|
||||
}).collect();
|
||||
|
||||
@@ -200,8 +212,6 @@ fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsByTokensRecord>
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_username: String,
|
||||
pub creator_display_name: String,
|
||||
@@ -210,12 +220,16 @@ fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsByTokensRecord>
|
||||
pub public_bucket_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
pub cached_user_ratings_negative_count: u32,
|
||||
pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
//pub cached_user_ratings_total_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
//pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
@@ -242,7 +256,6 @@ impl FromRow<'_, MySqlRow> for RawWeightJoinUser {
|
||||
weights_type: WeightsType::try_from_mysql_row(row, "weights_type")?,
|
||||
weights_category: WeightsCategory::try_from_mysql_row(row, "weights_category")?,
|
||||
title: row.try_get("title")?,
|
||||
maybe_thumbnail_token: row.try_get("maybe_thumbnail_token")?,
|
||||
creator_user_token: UserToken::new_from_str(row.try_get("creator_user_token")?),
|
||||
creator_username: row.try_get("creator_username")?,
|
||||
creator_display_name: row.try_get("creator_display_name")?,
|
||||
@@ -250,11 +263,14 @@ impl FromRow<'_, MySqlRow> for RawWeightJoinUser {
|
||||
public_bucket_hash: row.try_get("public_bucket_hash")?,
|
||||
maybe_public_bucket_prefix: row.try_get("maybe_public_bucket_prefix")?,
|
||||
maybe_public_bucket_extension: row.try_get("maybe_public_bucket_extension")?,
|
||||
cached_user_ratings_total_count: row.try_get("cached_user_ratings_total_count")?,
|
||||
cached_user_ratings_positive_count: row.try_get("cached_user_ratings_positive_count")?,
|
||||
cached_user_ratings_negative_count: row.try_get("cached_user_ratings_negative_count")?,
|
||||
maybe_cached_user_ratings_ratio: row.try_get("maybe_cached_user_ratings_ratio")?,
|
||||
cached_user_ratings_last_updated_at: row.try_get("cached_user_ratings_last_updated_at")?,
|
||||
maybe_cover_image_public_bucket_hash: row.try_get("maybe_cover_image_public_bucket_hash")?,
|
||||
maybe_cover_image_public_bucket_prefix: row.try_get("maybe_cover_image_public_bucket_prefix")?,
|
||||
maybe_cover_image_public_bucket_extension: row.try_get("maybe_cover_image_public_bucket_extension")?,
|
||||
//cached_user_ratings_total_count: row.try_get("cached_user_ratings_total_count")?,
|
||||
//cached_user_ratings_positive_count: row.try_get("cached_user_ratings_positive_count")?,
|
||||
//cached_user_ratings_negative_count: row.try_get("cached_user_ratings_negative_count")?,
|
||||
//maybe_cached_user_ratings_ratio: row.try_get("maybe_cached_user_ratings_ratio")?,
|
||||
//cached_user_ratings_last_updated_at: row.try_get("cached_user_ratings_last_updated_at")?,
|
||||
created_at: row.try_get("created_at")?,
|
||||
updated_at: row.try_get("updated_at")?,
|
||||
user_deleted_at: row.try_get("user_deleted_at")?,
|
||||
|
||||
@@ -6,6 +6,7 @@ use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::common::view_as::ViewAs;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums::traits::mysql_from_row::MySqlFromRow;
|
||||
use errors::AnyhowResult;
|
||||
@@ -21,7 +22,6 @@ pub struct WeightsForUserListPage {
|
||||
pub total_page_count: usize,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct WeightsJoinUserRecord {
|
||||
pub token: ModelWeightToken,
|
||||
@@ -30,11 +30,11 @@ pub struct WeightsJoinUserRecord {
|
||||
pub weights_category: WeightsCategory,
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
|
||||
// TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint.
|
||||
// Hopefully we don't break the frontend by omitting these.
|
||||
//pub maybe_description_markdown: String,
|
||||
//pub maybe_description_rendered_html: String,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_ip_address: String,
|
||||
@@ -51,6 +51,10 @@ pub struct WeightsJoinUserRecord {
|
||||
pub public_bucket_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
@@ -76,7 +80,9 @@ pub struct ListWeightsForUserArgs<'a> {
|
||||
pub page_size: usize,
|
||||
pub page_index: usize,
|
||||
pub sort_ascending: bool,
|
||||
pub can_see_deleted: bool,
|
||||
pub view_as: ViewAs,
|
||||
pub maybe_scoped_weight_type: Option<WeightsType>,
|
||||
pub maybe_scoped_weight_category: Option<WeightsCategory>,
|
||||
pub mysql_pool: &'a MySqlPool,
|
||||
}
|
||||
|
||||
@@ -89,7 +95,9 @@ pub async fn list_weights_by_creator_username(args: ListWeightsForUserArgs<'_>)
|
||||
0,
|
||||
args.sort_ascending,
|
||||
count_fields.as_str(),
|
||||
args.can_see_deleted,
|
||||
args.view_as,
|
||||
args.maybe_scoped_weight_type,
|
||||
args.maybe_scoped_weight_category,
|
||||
);
|
||||
|
||||
let row_count_query = count_query_builder.build_query_scalar::<i64>();
|
||||
@@ -104,7 +112,9 @@ pub async fn list_weights_by_creator_username(args: ListWeightsForUserArgs<'_>)
|
||||
args.page_size,
|
||||
args.sort_ascending,
|
||||
result_fields.as_str(),
|
||||
args.can_see_deleted,
|
||||
args.view_as,
|
||||
args.maybe_scoped_weight_type,
|
||||
args.maybe_scoped_weight_category,
|
||||
);
|
||||
|
||||
let query = query.build_query_as::<RawWeightJoinUser>();
|
||||
@@ -112,11 +122,8 @@ pub async fn list_weights_by_creator_username(args: ListWeightsForUserArgs<'_>)
|
||||
|
||||
let number_of_pages = (row_count_result / args.page_size as i64) as usize;
|
||||
|
||||
|
||||
|
||||
let weights_records: Vec<WeightsJoinUserRecord> = map_to_weights(results).await;
|
||||
|
||||
|
||||
Ok(WeightsForUserListPage {
|
||||
records: weights_records,
|
||||
sort_ascending: args.sort_ascending,
|
||||
@@ -134,38 +141,41 @@ fn select_total_count_field() -> String {
|
||||
|
||||
fn select_result_fields() -> String {
|
||||
r#"
|
||||
mw.token,
|
||||
mw.title,
|
||||
mw.weights_type,
|
||||
mw.weights_category,
|
||||
mw.maybe_thumbnail_token,
|
||||
mw.description_markdown,
|
||||
mw.description_rendered_html,
|
||||
u.token as creator_user_token,
|
||||
u.username as creator_username,
|
||||
u.display_name as creator_display_name,
|
||||
u.email_gravatar_hash as creator_email_gravatar_hash,
|
||||
mw.creator_ip_address,
|
||||
mw.creator_set_visibility,
|
||||
mw.maybe_last_update_user_token,
|
||||
mw.original_download_url,
|
||||
mw.original_filename,
|
||||
mw.file_size_bytes,
|
||||
mw.file_checksum_sha2,
|
||||
mw.public_bucket_hash,
|
||||
mw.maybe_public_bucket_prefix,
|
||||
mw.maybe_public_bucket_extension,
|
||||
mw.cached_user_ratings_negative_count,
|
||||
mw.cached_user_ratings_positive_count,
|
||||
mw.cached_user_ratings_total_count,
|
||||
mw.maybe_cached_user_ratings_ratio,
|
||||
mw.cached_user_ratings_last_updated_at,
|
||||
mw.version,
|
||||
mw.created_at,
|
||||
mw.updated_at,
|
||||
mw.user_deleted_at,
|
||||
mw.mod_deleted_at
|
||||
"#.to_string()
|
||||
mw.token,
|
||||
mw.title,
|
||||
mw.weights_type,
|
||||
mw.weights_category,
|
||||
u.token as creator_user_token,
|
||||
u.username as creator_username,
|
||||
u.display_name as creator_display_name,
|
||||
u.email_gravatar_hash as creator_email_gravatar_hash,
|
||||
mw.creator_ip_address,
|
||||
mw.creator_set_visibility,
|
||||
mw.maybe_last_update_user_token,
|
||||
mw.original_download_url,
|
||||
mw.original_filename,
|
||||
mw.file_size_bytes,
|
||||
mw.file_checksum_sha2,
|
||||
|
||||
mw.public_bucket_hash,
|
||||
mw.maybe_public_bucket_prefix,
|
||||
mw.maybe_public_bucket_extension,
|
||||
|
||||
cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,
|
||||
|
||||
mw.cached_user_ratings_negative_count,
|
||||
mw.cached_user_ratings_positive_count,
|
||||
mw.cached_user_ratings_total_count,
|
||||
mw.maybe_cached_user_ratings_ratio,
|
||||
mw.cached_user_ratings_last_updated_at,
|
||||
mw.version,
|
||||
mw.created_at,
|
||||
mw.updated_at,
|
||||
mw.user_deleted_at,
|
||||
mw.mod_deleted_at
|
||||
"#.to_string()
|
||||
}
|
||||
|
||||
fn query_builder<'a>(
|
||||
@@ -175,7 +185,9 @@ fn query_builder<'a>(
|
||||
page_size: usize,
|
||||
sort_ascending: bool,
|
||||
select_fields: &'a str,
|
||||
can_see_deleted: bool,
|
||||
view_as: ViewAs,
|
||||
maybe_scoped_weight_type: Option<WeightsType>,
|
||||
maybe_scoped_weight_category: Option<WeightsCategory>,
|
||||
) -> QueryBuilder<'a, MySql> {
|
||||
|
||||
// NB: Query cannot be statically checked by sqlx
|
||||
@@ -186,16 +198,35 @@ SELECT
|
||||
FROM model_weights as mw
|
||||
JOIN users as u
|
||||
ON u.token = mw.creator_user_token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = mw.maybe_cover_image_media_file_token
|
||||
"#
|
||||
));
|
||||
|
||||
if !can_see_deleted {
|
||||
query_builder.push(" WHERE mw.user_deleted_at IS NULL AND mw.mod_deleted_at IS NULL ");
|
||||
}
|
||||
|
||||
query_builder.push(" AND u.username = ");
|
||||
query_builder.push(" WHERE u.username = ");
|
||||
query_builder.push_bind(username);
|
||||
|
||||
match view_as {
|
||||
ViewAs::Author => {
|
||||
query_builder.push(" AND mw.user_deleted_at IS NULL AND mw.mod_deleted_at IS NULL ");
|
||||
}
|
||||
ViewAs::Moderator => {}
|
||||
ViewAs::AnotherUser => {
|
||||
query_builder.push(" AND mw.user_deleted_at IS NULL AND mw.mod_deleted_at IS NULL ");
|
||||
query_builder.push(" AND mw.creator_set_visibility = ");
|
||||
query_builder.push_bind(Visibility::Public.to_str());
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(weight_type) = maybe_scoped_weight_type {
|
||||
query_builder.push(" AND mw.weights_type = ");
|
||||
query_builder.push_bind(weight_type.to_str());
|
||||
}
|
||||
|
||||
if let Some(weight_category) = maybe_scoped_weight_category {
|
||||
query_builder.push(" AND mw.weights_category = ");
|
||||
query_builder.push_bind(weight_category.to_str());
|
||||
}
|
||||
|
||||
if sort_ascending {
|
||||
query_builder.push(" ORDER BY mw.created_at ASC ");
|
||||
@@ -215,44 +246,47 @@ JOIN users as u
|
||||
async fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsJoinUserRecord> {
|
||||
let weights: Vec<WeightsJoinUserRecord> = dataset
|
||||
.into_iter()
|
||||
.map(|dataset: RawWeightJoinUser| {
|
||||
.map(|weight: RawWeightJoinUser| {
|
||||
WeightsJoinUserRecord {
|
||||
token: dataset.token,
|
||||
title: dataset.title,
|
||||
weights_type: dataset.weights_type,
|
||||
weights_category: dataset.weights_category,
|
||||
maybe_thumbnail_token: dataset.maybe_thumbnail_token,
|
||||
description_markdown: dataset.description_markdown,
|
||||
description_rendered_html: dataset.description_rendered_html,
|
||||
token: weight.token,
|
||||
title: weight.title,
|
||||
weights_type: weight.weights_type,
|
||||
weights_category: weight.weights_category,
|
||||
//maybe_description_markdown: weight.maybe_description_markdown,
|
||||
//maybe_description_rendered_html: weight.maybe_description_rendered_html,
|
||||
|
||||
creator_user_token: dataset.creator_user_token,
|
||||
creator_ip_address: dataset.creator_ip_address,
|
||||
creator_set_visibility: dataset.creator_set_visibility,
|
||||
creator_user_token: weight.creator_user_token,
|
||||
creator_ip_address: weight.creator_ip_address,
|
||||
creator_set_visibility: weight.creator_set_visibility,
|
||||
|
||||
maybe_last_update_user_token: dataset.maybe_last_update_user_token,
|
||||
original_download_url: dataset.original_download_url,
|
||||
original_filename: dataset.original_filename,
|
||||
file_size_bytes: dataset.file_size_bytes,
|
||||
file_checksum_sha2: dataset.file_checksum_sha2,
|
||||
public_bucket_hash: dataset.public_bucket_hash,
|
||||
maybe_public_bucket_prefix: dataset.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: dataset.maybe_public_bucket_extension,
|
||||
maybe_last_update_user_token: weight.maybe_last_update_user_token,
|
||||
original_download_url: weight.original_download_url,
|
||||
original_filename: weight.original_filename,
|
||||
file_size_bytes: weight.file_size_bytes,
|
||||
file_checksum_sha2: weight.file_checksum_sha2,
|
||||
public_bucket_hash: weight.public_bucket_hash,
|
||||
maybe_public_bucket_prefix: weight.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: weight.maybe_public_bucket_extension,
|
||||
|
||||
cached_user_ratings_negative_count: dataset.cached_user_ratings_negative_count,
|
||||
cached_user_ratings_positive_count: dataset.cached_user_ratings_positive_count,
|
||||
cached_user_ratings_total_count: dataset.cached_user_ratings_total_count,
|
||||
maybe_cover_image_public_bucket_hash: weight.maybe_cover_image_public_bucket_hash,
|
||||
maybe_cover_image_public_bucket_prefix: weight.maybe_cover_image_public_bucket_prefix,
|
||||
maybe_cover_image_public_bucket_extension: weight.maybe_cover_image_public_bucket_extension,
|
||||
|
||||
maybe_cached_user_ratings_ratio: dataset.maybe_cached_user_ratings_ratio,
|
||||
cached_user_ratings_last_updated_at: dataset.cached_user_ratings_last_updated_at,
|
||||
version: dataset.version,
|
||||
created_at: dataset.created_at,
|
||||
updated_at: dataset.updated_at,
|
||||
user_deleted_at: dataset.user_deleted_at,
|
||||
mod_deleted_at: dataset.mod_deleted_at,
|
||||
cached_user_ratings_negative_count: weight.cached_user_ratings_negative_count,
|
||||
cached_user_ratings_positive_count: weight.cached_user_ratings_positive_count,
|
||||
cached_user_ratings_total_count: weight.cached_user_ratings_total_count,
|
||||
|
||||
creator_username:dataset.creator_username,
|
||||
creator_display_name:dataset.creator_display_name,
|
||||
creator_email_gravatar_hash:dataset.creator_email_gravatar_hash
|
||||
maybe_cached_user_ratings_ratio: weight.maybe_cached_user_ratings_ratio,
|
||||
cached_user_ratings_last_updated_at: weight.cached_user_ratings_last_updated_at,
|
||||
version: weight.version,
|
||||
created_at: weight.created_at,
|
||||
updated_at: weight.updated_at,
|
||||
user_deleted_at: weight.user_deleted_at,
|
||||
mod_deleted_at: weight.mod_deleted_at,
|
||||
|
||||
creator_username: weight.creator_username,
|
||||
creator_display_name: weight.creator_display_name,
|
||||
creator_email_gravatar_hash: weight.creator_email_gravatar_hash,
|
||||
}
|
||||
}).collect();
|
||||
|
||||
@@ -267,11 +301,11 @@ async fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsJoinUserRe
|
||||
pub weights_category: WeightsCategory,
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
|
||||
// TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint.
|
||||
// Hopefully we don't break the frontend by omitting these.
|
||||
//pub description_markdown: String,
|
||||
//pub description_rendered_html: String,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_ip_address: String,
|
||||
@@ -288,7 +322,11 @@ async fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsJoinUserRe
|
||||
pub public_bucket_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
pub cached_user_ratings_negative_count: u32,
|
||||
@@ -309,15 +347,16 @@ async fn map_to_weights(dataset:Vec<RawWeightJoinUser>) -> Vec<WeightsJoinUserRe
|
||||
}
|
||||
|
||||
impl FromRow<'_, MySqlRow> for RawWeightJoinUser {
|
||||
fn from_row(row: &MySqlRow) -> std::result::Result<Self, sqlx::Error> {
|
||||
fn from_row(row: &MySqlRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self {
|
||||
token: row.try_get("token")?,
|
||||
weights_type: row.try_get("weights_type")?,
|
||||
weights_category: row.try_get("weights_category")?,
|
||||
title: row.try_get("title")?,
|
||||
maybe_thumbnail_token: row.try_get("maybe_thumbnail_token")?,
|
||||
description_markdown: row.try_get("description_markdown")?,
|
||||
description_rendered_html: row.try_get("description_rendered_html")?,
|
||||
// TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint.
|
||||
// Hopefully we don't break the frontend by omitting these.
|
||||
//maybe_description_markdown: row.try_get("maybe_description_markdown")?,
|
||||
//maybe_description_rendered_html: row.try_get("maybe_description_rendered_html")?,
|
||||
creator_user_token: row.try_get("creator_user_token")?,
|
||||
creator_ip_address: row.try_get("creator_ip_address")?,
|
||||
creator_set_visibility: Visibility::try_from_mysql_row(row, "creator_set_visibility")?,
|
||||
@@ -329,6 +368,9 @@ impl FromRow<'_, MySqlRow> for RawWeightJoinUser {
|
||||
public_bucket_hash: row.try_get("public_bucket_hash")?,
|
||||
maybe_public_bucket_prefix: row.try_get("maybe_public_bucket_prefix")?,
|
||||
maybe_public_bucket_extension: row.try_get("maybe_public_bucket_extension")?,
|
||||
maybe_cover_image_public_bucket_hash: row.try_get("maybe_cover_image_public_bucket_hash")?,
|
||||
maybe_cover_image_public_bucket_prefix: row.try_get("maybe_cover_image_public_bucket_prefix")?,
|
||||
maybe_cover_image_public_bucket_extension: row.try_get("maybe_cover_image_public_bucket_extension")?,
|
||||
cached_user_ratings_total_count: row.try_get("cached_user_ratings_total_count")?,
|
||||
cached_user_ratings_positive_count: row.try_get("cached_user_ratings_positive_count")?,
|
||||
cached_user_ratings_negative_count: row.try_get("cached_user_ratings_negative_count")?,
|
||||
|
||||
+47
-47
@@ -36,10 +36,8 @@ pub struct WeightJoinUser {
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_ip_address: String,
|
||||
@@ -57,11 +55,15 @@ pub struct WeightJoinUser {
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
pub cached_user_ratings_negative_count: u32,
|
||||
pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
//pub cached_user_ratings_total_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
//pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
|
||||
pub version: i32,
|
||||
|
||||
@@ -160,13 +162,15 @@ impl ListWeightsQueryBuilder {
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<Vec<RawWeightJoinUser>> {
|
||||
let query = self.build_query_string();
|
||||
//println!("HERE! query: {}", query);
|
||||
//panic!("query: {:?}", query);
|
||||
|
||||
let mut query = sqlx::query_as::<_, RawWeightJoinUser>(&query);
|
||||
|
||||
// NB: The following bindings must match the order of the query builder !!
|
||||
|
||||
if let Some(offset) = self.offset {
|
||||
query = query.bind(offset);
|
||||
}
|
||||
|
||||
if let Some(username) = self.scope_creator_username.as_deref() {
|
||||
query = query.bind(username);
|
||||
}
|
||||
@@ -181,9 +185,6 @@ impl ListWeightsQueryBuilder {
|
||||
|
||||
query = query.bind(self.limit);
|
||||
|
||||
if let Some(offset) = self.offset {
|
||||
query = query.bind(offset);
|
||||
}
|
||||
|
||||
let mut results = query.fetch_all(mysql_pool).await?;
|
||||
|
||||
@@ -216,9 +217,8 @@ impl ListWeightsQueryBuilder {
|
||||
record.weights_category.as_str()
|
||||
).unwrap(),
|
||||
title: record.title,
|
||||
maybe_thumbnail_token: record.maybe_thumbnail_token,
|
||||
description_markdown: record.description_markdown,
|
||||
description_rendered_html: record.description_rendered_html,
|
||||
maybe_description_markdown: record.maybe_description_markdown,
|
||||
maybe_description_rendered_html: record.maybe_description_rendered_html,
|
||||
creator_user_token: UserToken::new_from_str(&record.creator_user_token),
|
||||
creator_ip_address: record.creator_ip_address,
|
||||
creator_set_visibility: Visibility::from_str(
|
||||
@@ -234,11 +234,14 @@ impl ListWeightsQueryBuilder {
|
||||
public_bucket_hash: record.public_bucket_hash,
|
||||
maybe_public_bucket_prefix: record.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: record.maybe_public_bucket_extension,
|
||||
cached_user_ratings_total_count: record.cached_user_ratings_total_count,
|
||||
cached_user_ratings_positive_count: record.cached_user_ratings_positive_count,
|
||||
cached_user_ratings_negative_count: record.cached_user_ratings_negative_count,
|
||||
maybe_cached_user_ratings_ratio: record.maybe_cached_user_ratings_ratio,
|
||||
cached_user_ratings_last_updated_at: record.cached_user_ratings_last_updated_at,
|
||||
maybe_cover_image_public_bucket_hash: record.maybe_cover_image_public_bucket_hash,
|
||||
maybe_cover_image_public_bucket_prefix: record.maybe_cover_image_public_bucket_prefix,
|
||||
maybe_cover_image_public_bucket_extension: record.maybe_cover_image_public_bucket_extension,
|
||||
//cached_user_ratings_total_count: record.cached_user_ratings_total_count,
|
||||
//cached_user_ratings_positive_count: record.cached_user_ratings_positive_count,
|
||||
//cached_user_ratings_negative_count: record.cached_user_ratings_negative_count,
|
||||
//maybe_cached_user_ratings_ratio: record.maybe_cached_user_ratings_ratio,
|
||||
//cached_user_ratings_last_updated_at: record.cached_user_ratings_last_updated_at,
|
||||
version: record.version,
|
||||
created_at: record.created_at,
|
||||
updated_at: record.updated_at,
|
||||
@@ -268,9 +271,8 @@ impl ListWeightsQueryBuilder {
|
||||
model_weights.weights_type,
|
||||
model_weights.weights_category,
|
||||
model_weights.title,
|
||||
model_weights.maybe_thumbnail_token,
|
||||
model_weights.description_markdown,
|
||||
model_weights.description_rendered_html,
|
||||
model_weights.maybe_description_markdown,
|
||||
model_weights.maybe_description_rendered_html,
|
||||
model_weights.creator_user_token,
|
||||
model_weights.creator_ip_address,
|
||||
model_weights.creator_set_visibility,
|
||||
@@ -282,11 +284,9 @@ impl ListWeightsQueryBuilder {
|
||||
model_weights.public_bucket_hash,
|
||||
model_weights.maybe_public_bucket_prefix,
|
||||
model_weights.maybe_public_bucket_extension,
|
||||
model_weights.cached_user_ratings_total_count,
|
||||
model_weights.cached_user_ratings_positive_count,
|
||||
model_weights.cached_user_ratings_negative_count,
|
||||
model_weights.maybe_cached_user_ratings_ratio,
|
||||
model_weights.cached_user_ratings_last_updated_at,
|
||||
cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,
|
||||
cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,
|
||||
cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,
|
||||
model_weights.version,
|
||||
model_weights.created_at,
|
||||
model_weights.updated_at,
|
||||
@@ -298,6 +298,8 @@ impl ListWeightsQueryBuilder {
|
||||
FROM model_weights
|
||||
JOIN users
|
||||
ON users.token = model_weights.creator_user_token
|
||||
LEFT OUTER JOIN media_files as cover_image
|
||||
ON cover_image.token = model_weights.maybe_cover_image_media_file_token
|
||||
"#.to_string();
|
||||
|
||||
query.push_str(&self.build_predicates());
|
||||
@@ -323,18 +325,18 @@ impl ListWeightsQueryBuilder {
|
||||
if sort_ascending {
|
||||
if self.cursor_is_reversed {
|
||||
// NB: We're searching backwards.
|
||||
query.push_str(" model_weights.id");
|
||||
query.push_str(" model_weights.id < ? ");
|
||||
sort_ascending = !sort_ascending;
|
||||
} else {
|
||||
query.push_str(" model_weights.id");
|
||||
query.push_str(" model_weights.id > ? ");
|
||||
}
|
||||
} else {
|
||||
if self.cursor_is_reversed {
|
||||
// NB: We're searching backwards.
|
||||
query.push_str(" model_weights.id");
|
||||
query.push_str(" model_weights.id > ? ");
|
||||
sort_ascending = !sort_ascending;
|
||||
} else {
|
||||
query.push_str(" model_weights.id");
|
||||
query.push_str(" model_weights.id < ? ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,10 +405,6 @@ impl ListWeightsQueryBuilder {
|
||||
query.push_str(" LIMIT ?");
|
||||
}
|
||||
|
||||
if let Some(_) = self.offset {
|
||||
query.push_str(" OFFSET ?");
|
||||
}
|
||||
|
||||
query
|
||||
}
|
||||
}
|
||||
@@ -422,10 +420,8 @@ struct RawWeightJoinUser {
|
||||
|
||||
pub title: String,
|
||||
|
||||
pub maybe_thumbnail_token: Option<String>,
|
||||
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
pub maybe_description_markdown: Option<String>,
|
||||
pub maybe_description_rendered_html: Option<String>,
|
||||
|
||||
pub creator_user_token: String,
|
||||
pub creator_ip_address: String,
|
||||
@@ -443,11 +439,15 @@ struct RawWeightJoinUser {
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub cached_user_ratings_total_count: u32,
|
||||
pub cached_user_ratings_positive_count: u32,
|
||||
pub cached_user_ratings_negative_count: u32,
|
||||
pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
pub maybe_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
//pub cached_user_ratings_total_count: u32,
|
||||
//pub cached_user_ratings_positive_count: u32,
|
||||
//pub cached_user_ratings_negative_count: u32,
|
||||
//pub maybe_cached_user_ratings_ratio: Option<f32>,
|
||||
//pub cached_user_ratings_last_updated_at: DateTime<Utc>,
|
||||
|
||||
pub version: i32,
|
||||
|
||||
|
||||
+6
-20
@@ -76,11 +76,9 @@ SET
|
||||
weights_type = ?,
|
||||
weights_category = ?,
|
||||
title = ?,
|
||||
maybe_thumbnail_token = NULL,
|
||||
maybe_avatar_media_file_token = NULL,
|
||||
maybe_cover_media_file_token = NULL,
|
||||
description_markdown = ?,
|
||||
description_rendered_html = ?,
|
||||
maybe_cover_image_media_file_token = NULL,
|
||||
maybe_description_markdown = ?,
|
||||
maybe_description_rendered_html = ?,
|
||||
creator_user_token = ?,
|
||||
creator_ip_address = ?,
|
||||
|
||||
@@ -94,11 +92,6 @@ SET
|
||||
public_bucket_hash = ?,
|
||||
maybe_public_bucket_prefix = ?,
|
||||
maybe_public_bucket_extension = ?,
|
||||
cached_user_ratings_total_count = 0,
|
||||
cached_user_ratings_positive_count = 0,
|
||||
cached_user_ratings_negative_count = 0,
|
||||
maybe_cached_user_ratings_ratio = 0.0,
|
||||
cached_user_ratings_last_updated_at = NOW(),
|
||||
|
||||
maybe_migration_old_model_token = ?,
|
||||
version = ?,
|
||||
@@ -111,11 +104,9 @@ ON DUPLICATE KEY UPDATE
|
||||
weights_type = ?,
|
||||
weights_category = ?,
|
||||
title = ?,
|
||||
maybe_thumbnail_token = NULL,
|
||||
maybe_avatar_media_file_token = NULL,
|
||||
maybe_cover_media_file_token = NULL,
|
||||
description_markdown = ?,
|
||||
description_rendered_html = ?,
|
||||
maybe_cover_image_media_file_token = NULL,
|
||||
maybe_description_markdown = ?,
|
||||
maybe_description_rendered_html = ?,
|
||||
creator_user_token = ?,
|
||||
creator_ip_address = ?,
|
||||
creator_set_visibility = ?,
|
||||
@@ -127,11 +118,6 @@ ON DUPLICATE KEY UPDATE
|
||||
public_bucket_hash = ?,
|
||||
maybe_public_bucket_prefix = ?,
|
||||
maybe_public_bucket_extension = ?,
|
||||
cached_user_ratings_total_count = 0,
|
||||
cached_user_ratings_positive_count = 0,
|
||||
cached_user_ratings_negative_count = 0,
|
||||
maybe_cached_user_ratings_ratio = 0.0,
|
||||
cached_user_ratings_last_updated_at = NOW(),
|
||||
maybe_migration_old_model_token = ?,
|
||||
version = ?,
|
||||
created_at = ?,
|
||||
|
||||
@@ -4,9 +4,8 @@ CREATE TABLE model_weights (
|
||||
weights_type VARCHAR(32) NOT NULL,
|
||||
weights_category VARCHAR(32) NOT NULL,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
maybe_thumbnail_token VARCHAR(32) DEFAULT NULL,
|
||||
description_markdown TEXT NOT NULL,
|
||||
description_rendered_html TEXT NOT NULL,
|
||||
maybe_description_markdown TEXT DEFAULT NULL,
|
||||
maybe_description_rendered_html TEXT DEFAULT NULL,
|
||||
creator_user_token VARCHAR(32) NOT NULL,
|
||||
creator_ip_address VARCHAR(40) NOT NULL,
|
||||
creator_set_visibility ENUM(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#[ignore]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use anyhow::Ok;
|
||||
@@ -14,6 +15,7 @@ mod tests {
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::common::view_as::ViewAs;
|
||||
use enums::common::visibility::Visibility;
|
||||
use tokens::tokens::{model_weights::ModelWeightToken, users::UserToken};
|
||||
|
||||
@@ -65,9 +67,8 @@ mod tests {
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 1".to_string()),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token1), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -79,10 +80,10 @@ mod tests {
|
||||
public_bucket_hash: "bucket_hash1".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("rvc".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &pool, // replace with actual MySqlPool
|
||||
};
|
||||
@@ -98,9 +99,8 @@ mod tests {
|
||||
assert_eq!(result.title, "Title 1".to_string());
|
||||
assert_eq!(result.weights_type, WeightsType::RvcV2);
|
||||
assert_eq!(result.weights_category, WeightsCategory::VoiceConversion);
|
||||
assert_eq!(result.maybe_thumbnail_token, Some("Thumbnail 1".to_string()));
|
||||
assert_eq!(result.description_markdown, "Description 1".to_string());
|
||||
assert_eq!(result.description_rendered_html, "<p>Description 1</p>".to_string());
|
||||
assert_eq!(result.maybe_description_markdown, Some("Description 1".to_string()));
|
||||
assert_eq!(result.maybe_description_rendered_html, Some("<p>Description 1</p>".to_string()));
|
||||
assert_eq!(result.creator_user_token, creator_token1);
|
||||
assert_eq!(result.creator_ip_address, "192.168.1.1".to_string());
|
||||
assert_eq!(result.creator_set_visibility, Visibility::Public);
|
||||
@@ -140,9 +140,8 @@ mod tests {
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 1".to_string()),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token1), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -154,10 +153,10 @@ mod tests {
|
||||
public_bucket_hash: "bucket_hash1".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("rvc".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &pool, // replace with actual MySqlPool
|
||||
};
|
||||
@@ -217,9 +216,8 @@ mod tests {
|
||||
weights_type: WeightsType::RvcV2, // replace with actual WeightsType
|
||||
weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory
|
||||
title: "Title 1".to_string(),
|
||||
maybe_thumbnail_token: Some("Thumbnail 1".to_string()),
|
||||
description_markdown: "Description 1".to_string(),
|
||||
description_rendered_html: "<p>Description 1</p>".to_string(),
|
||||
maybe_description_markdown: Some("Description 1".to_string()),
|
||||
maybe_description_rendered_html: Some("<p>Description 1</p>".to_string()),
|
||||
creator_user_token: Some(&creator_token1), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -231,10 +229,10 @@ mod tests {
|
||||
public_bucket_hash: "bucket_hash1".to_string(),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("rvc".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &pool, // replace with actual MySqlPool
|
||||
};
|
||||
@@ -281,7 +279,7 @@ mod tests {
|
||||
let pool = setup().await;
|
||||
|
||||
let creator_username = "hanashi".to_string();
|
||||
let can_see_deleted = true;
|
||||
let view_as = ViewAs::Moderator;
|
||||
|
||||
seed_weights_with_category_and_type(
|
||||
WeightsType::LoRA,
|
||||
@@ -295,7 +293,9 @@ mod tests {
|
||||
page_size: 0,
|
||||
page_index: 0,
|
||||
sort_ascending: false,
|
||||
can_see_deleted,
|
||||
view_as,
|
||||
maybe_scoped_weight_type: None,
|
||||
maybe_scoped_weight_category: None,
|
||||
mysql_pool: &pool,
|
||||
}).await?;
|
||||
for weight in weights_by_username.records.iter() {
|
||||
@@ -329,12 +329,11 @@ mod tests {
|
||||
|
||||
let args = CreateModelWeightsArgs {
|
||||
token: &model_weight_token, // replace with actual ModelWeightToken
|
||||
weights_type: weights_type, // replace with actual WeightsType
|
||||
weights_category: weights_category, // replace with actual WeightsCategory
|
||||
weights_type, // replace with actual WeightsType
|
||||
weights_category, // replace with actual WeightsCategory
|
||||
title: format!("Title {}", i),
|
||||
maybe_thumbnail_token: Some(format!("Thumbnail {}", i)),
|
||||
description_markdown: format!("Description {}", i),
|
||||
description_rendered_html: format!("<p>Description {}</p>", i),
|
||||
maybe_description_markdown: Some(format!("Description {}", i)),
|
||||
maybe_description_rendered_html: Some(format!("<p>Description {}</p>", i)),
|
||||
creator_user_token: Some(&creator_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -346,10 +345,10 @@ mod tests {
|
||||
public_bucket_hash: format!("bucket_hash{}", i),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("rvc".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &pool, // replace with actual MySqlPool
|
||||
};
|
||||
@@ -572,12 +571,11 @@ mod tests {
|
||||
|
||||
let args = CreateModelWeightsArgs {
|
||||
token: &model_weight_token, // replace with actual ModelWeightToken
|
||||
weights_type: weights_type, // replace with actual WeightsType
|
||||
weights_category: weights_category, // replace with actual WeightsCategory
|
||||
weights_type, // replace with actual WeightsType
|
||||
weights_category, // replace with actual WeightsCategory
|
||||
title: format!("Title {}", i),
|
||||
maybe_thumbnail_token: Some(format!("Thumbnail {}", i)),
|
||||
description_markdown: format!("Description {}", i),
|
||||
description_rendered_html: format!("<p>Description {}</p>", i),
|
||||
maybe_description_markdown: Some(format!("Description {}", i)),
|
||||
maybe_description_rendered_html: Some(format!("<p>Description {}</p>", i)),
|
||||
creator_user_token: Some(&creator_token), // replace with actual UserToken
|
||||
creator_ip_address: "192.168.1.1",
|
||||
creator_set_visibility: Visibility::Public,
|
||||
@@ -589,10 +587,10 @@ mod tests {
|
||||
public_bucket_hash: format!("bucket_hash{}", i),
|
||||
maybe_public_bucket_prefix: Some("_fake".to_string()),
|
||||
maybe_public_bucket_extension: Some("rvc".to_string()),
|
||||
cached_user_ratings_total_count: 10,
|
||||
cached_user_ratings_positive_count: 9,
|
||||
cached_user_ratings_negative_count: 1,
|
||||
maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
//cached_user_ratings_total_count: 10,
|
||||
//cached_user_ratings_positive_count: 9,
|
||||
//cached_user_ratings_negative_count: 1,
|
||||
//maybe_cached_user_ratings_ratio: Some(0.9),
|
||||
version: 1,
|
||||
mysql_pool: &pool, // replace with actual MySqlPool
|
||||
};
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ pub async fn mark_tts_upload_job_failure(
|
||||
next_status = "dead";
|
||||
}
|
||||
|
||||
let query_result = sqlx::query!(
|
||||
let _query_result = sqlx::query!(
|
||||
r#"
|
||||
UPDATE tts_model_upload_jobs
|
||||
SET
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use anyhow::anyhow;
|
||||
use chrono::{DateTime, Utc};
|
||||
use log::{info, warn};
|
||||
use sqlx::{MySql, MySqlPool};
|
||||
use sqlx::{Error, MySql, MySqlPool};
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use enums::common::visibility::Visibility;
|
||||
@@ -75,13 +75,13 @@ pub async fn list_tts_models_with_connection(
|
||||
let models : Vec<InternalRawTtsModelRecordForList> = match maybe_models {
|
||||
Ok(models) => models,
|
||||
Err(err) => {
|
||||
match err {
|
||||
RowNotFound => {
|
||||
return Ok(Vec::new());
|
||||
return match err {
|
||||
Error::RowNotFound => {
|
||||
Ok(Vec::new())
|
||||
},
|
||||
_ => {
|
||||
warn!("tts model list query error: {:?}", err);
|
||||
return Err(anyhow!("tts model list query error"));
|
||||
Err(anyhow!("tts model list query error"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ pub async fn list_tts_models_with_connection(
|
||||
async fn list_tts_models_for_all_creators(
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
allow_mod_disabled: bool
|
||||
) -> AnyhowResult<Vec<InternalRawTtsModelRecordForList>> {
|
||||
) -> Result<Vec<InternalRawTtsModelRecordForList>, Error> {
|
||||
// TODO: There has to be a better way.
|
||||
// Sqlx doesn't like anything except string literals.
|
||||
let maybe_models = if !allow_mod_disabled {
|
||||
@@ -198,7 +198,7 @@ async fn list_tts_models_creator_scoped(
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
scope_creator_username: &str,
|
||||
allow_mod_disabled: bool
|
||||
) -> AnyhowResult<Vec<InternalRawTtsModelRecordForList>> {
|
||||
) -> Result<Vec<InternalRawTtsModelRecordForList>, Error> {
|
||||
// TODO: There has to be a better way.
|
||||
// Sqlx doesn't like anything except string literals.
|
||||
let maybe_models = if !allow_mod_disabled {
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
use anyhow::anyhow;
|
||||
use chrono::{DateTime, Utc};
|
||||
use log::warn;
|
||||
use sqlx::{MySql, MySqlPool};
|
||||
use sqlx::{Error, MySql, MySqlPool};
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use enums::by_table::tts_models::tts_model_type::TtsModelType;
|
||||
@@ -104,13 +104,13 @@ pub async fn list_whole_tts_models_using_cursor(
|
||||
let models : Vec<RawRecord> = match maybe_models {
|
||||
Ok(models) => models,
|
||||
Err(err) => {
|
||||
match err {
|
||||
RowNotFound => {
|
||||
return Ok(Vec::new());
|
||||
return match err {
|
||||
Error::RowNotFound => {
|
||||
Ok(Vec::new())
|
||||
},
|
||||
_ => {
|
||||
warn!("vc model list query error: {:?}", err);
|
||||
return Err(anyhow!("vc model list query error"));
|
||||
Err(anyhow!("vc model list query error"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ async fn list_whole_voice_conversion_models(
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
page_size: u64,
|
||||
cursor: u64,
|
||||
) -> AnyhowResult<Vec<RawRecord>> {
|
||||
) -> Result<Vec<RawRecord>, Error> {
|
||||
Ok(sqlx::query_as!(
|
||||
RawRecord,
|
||||
r#"
|
||||
|
||||
+1
-1
@@ -241,7 +241,7 @@ LEFT OUTER JOIN users
|
||||
|
||||
let mut query = "".to_string();
|
||||
|
||||
if let Some(offset) = self.offset {
|
||||
if let Some(_offset) = self.offset {
|
||||
if !first_predicate_added {
|
||||
query.push_str(" WHERE");
|
||||
first_predicate_added = true;
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ pub async fn reorder_twitch_event_rules(
|
||||
.join("\n");
|
||||
|
||||
let query_inner_ip_addresses = rule_token_to_order_map.iter()
|
||||
.map(|(token, position)| {
|
||||
.map(|(token, _position)| {
|
||||
format!("when token = '{}' then '{}'", token.as_str(), ip_address_update)
|
||||
})
|
||||
.collect::<Vec<String>>()
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use log::error;
|
||||
use sqlx::{MySql, QueryBuilder};
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::user_bookmarks::UserBookmarkToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
pub struct BatchUserBookmark {
|
||||
pub token: UserBookmarkToken,
|
||||
pub entity_token: String,
|
||||
pub entity_type: UserBookmarkEntityType,
|
||||
}
|
||||
|
||||
pub async fn batch_get_user_bookmarks(
|
||||
user_token: &UserToken,
|
||||
tokens: &HashSet<String>,
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
) -> AnyhowResult<Vec<BatchUserBookmark>>
|
||||
{
|
||||
if tokens.len() == 0 {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
|
||||
let mut query_builder: QueryBuilder<MySql> = QueryBuilder::new(
|
||||
r#"
|
||||
SELECT
|
||||
token,
|
||||
entity_type,
|
||||
entity_token
|
||||
|
||||
FROM user_bookmarks
|
||||
|
||||
WHERE user_token =
|
||||
"#);
|
||||
|
||||
query_builder.push_bind(user_token.as_str());
|
||||
|
||||
query_builder.push(" AND entity_token IN ( ");
|
||||
|
||||
// NB: Syntax will be wrong if list has zero length
|
||||
let mut separated = query_builder.separated(", ");
|
||||
|
||||
for token in tokens.iter() {
|
||||
separated.push_bind(token);
|
||||
}
|
||||
|
||||
separated.push_unseparated(") ");
|
||||
|
||||
let query = query_builder.build_query_as::<RawRating>();
|
||||
|
||||
let maybe_results = query.fetch_all(&mut **mysql_connection).await;
|
||||
|
||||
match maybe_results {
|
||||
Ok(records) => Ok(records
|
||||
.into_iter()
|
||||
.map(|record| BatchUserBookmark {
|
||||
token: UserBookmarkToken::new_from_str(&record.token),
|
||||
// NB: Fail open; W2lTemplates are dead, so this is a good sentinel value
|
||||
entity_type: UserBookmarkEntityType::from_str(&record.entity_type)
|
||||
.unwrap_or(UserBookmarkEntityType::W2lTemplate),
|
||||
entity_token: record.entity_token,
|
||||
}).collect::<Vec<_>>()),
|
||||
Err(err) => match err {
|
||||
sqlx::Error::RowNotFound => Ok(Vec::new()),
|
||||
_ => {
|
||||
error!("error querying : {:?}", err);
|
||||
Err(anyhow!("error querying : {:?}", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(sqlx::FromRow)]
|
||||
struct RawRating {
|
||||
token: String,
|
||||
entity_token: String,
|
||||
entity_type: String,
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
use anyhow::anyhow;
|
||||
use log::warn;
|
||||
use sqlx::{Executor, MySql};
|
||||
use sqlx::pool::PoolConnection;
|
||||
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::queries::user_bookmarks::user_bookmark_entity_token::UserBookmarkEntityToken;
|
||||
|
||||
pub struct BookmarkCount {
|
||||
pub total_count: usize,
|
||||
}
|
||||
|
||||
pub async fn get_total_bookmark_count_for_entity(
|
||||
user_bookmark_entity_token: &UserBookmarkEntityToken,
|
||||
mysql_connection: &mut PoolConnection<MySql>,
|
||||
) -> AnyhowResult<BookmarkCount> {
|
||||
|
||||
let (entity_type, entity_token) = user_bookmark_entity_token.get_composite_keys();
|
||||
|
||||
let maybe_result = sqlx::query_as!(
|
||||
RawRecord,
|
||||
r#"
|
||||
SELECT
|
||||
COUNT(*) as total_count
|
||||
FROM
|
||||
user_bookmarks
|
||||
WHERE
|
||||
entity_type = ?
|
||||
AND entity_token = ?
|
||||
AND deleted_at IS NULL
|
||||
"#,
|
||||
entity_type,
|
||||
entity_token
|
||||
)
|
||||
.fetch_one(&mut **mysql_connection)
|
||||
.await;
|
||||
|
||||
match maybe_result {
|
||||
Err(err) => match err {
|
||||
sqlx::Error::RowNotFound => Ok(BookmarkCount { total_count: 0 }),
|
||||
_ => {
|
||||
warn!("get_total_bookmark_count db error: {:?}", err);
|
||||
Err(anyhow!("error with query: {:?}", err))
|
||||
}
|
||||
},
|
||||
Ok(result) => Ok(result.into_public_type()),
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RawRecord {
|
||||
total_count: i64,
|
||||
}
|
||||
|
||||
impl RawRecord {
|
||||
pub fn into_public_type(self) -> BookmarkCount {
|
||||
BookmarkCount {
|
||||
total_count: self.total_count as usize,
|
||||
}
|
||||
}
|
||||
}
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
use anyhow::anyhow;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sqlx::{Error, Executor, MySql};
|
||||
|
||||
use enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::user_bookmarks::UserBookmarkToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
use crate::queries::user_bookmarks::user_bookmark_entity_token::UserBookmarkEntityToken;
|
||||
|
||||
pub struct UserBookmark {
|
||||
pub token: UserBookmarkToken,
|
||||
|
||||
pub entity_type: UserBookmarkEntityType,
|
||||
pub entity_token: String,
|
||||
|
||||
pub user_token: UserToken,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub maybe_deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
pub enum BookmarkIdentifier<'a> {
|
||||
BookmarkToken(&'a UserBookmarkToken),
|
||||
EntityTypeAndToken(&'a UserBookmarkEntityToken),
|
||||
}
|
||||
|
||||
/// Use SELECT FOR UPDATE to lock the rows for the duration of the transaction.
|
||||
/// We're locking two tables at once: https://stackoverflow.com/a/38545378
|
||||
pub async fn get_user_bookmark_transactional_locking<'e, 'c, E>(
|
||||
bookmark_identifier: BookmarkIdentifier<'e>,
|
||||
mysql_executor: E
|
||||
) -> AnyhowResult<Option<UserBookmark>>
|
||||
where E: 'e + Executor<'c, Database = MySql>
|
||||
{
|
||||
let maybe_results = match bookmark_identifier {
|
||||
BookmarkIdentifier::EntityTypeAndToken(bookmark_entity_token) => {
|
||||
query_by_entity(mysql_executor, bookmark_entity_token).await
|
||||
}
|
||||
BookmarkIdentifier::BookmarkToken(bookmark_token) => {
|
||||
query_by_bookmark_token(mysql_executor, bookmark_token).await
|
||||
}
|
||||
};
|
||||
|
||||
match maybe_results {
|
||||
Ok(user_bookmark) => Ok(Some(UserBookmark {
|
||||
token: user_bookmark.token,
|
||||
entity_type: user_bookmark.entity_type,
|
||||
entity_token: user_bookmark.entity_token,
|
||||
user_token: user_bookmark.user_token,
|
||||
created_at: user_bookmark.created_at,
|
||||
updated_at: user_bookmark.updated_at,
|
||||
maybe_deleted_at: user_bookmark.deleted_at,
|
||||
})),
|
||||
Err(err) => match err {
|
||||
sqlx::Error::RowNotFound => Ok(None),
|
||||
_ => Err(anyhow!("Error querying for IP ban: {:?}", err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn query_by_entity<'e, 'c, E>(mysql_executor: E, bookmark_entity_token: &UserBookmarkEntityToken)
|
||||
-> Result<RawUserBookmark, Error> where E: 'e + Executor<'c, Database=MySql>
|
||||
{
|
||||
let (entity_type, entity_token) = bookmark_entity_token.get_composite_keys();
|
||||
|
||||
// NB: LEFT OUTER JOIN does not require entity_stats to be present, but will lock it under
|
||||
// SELECT...FOR UPDATE if the row exists.
|
||||
sqlx::query_as!(
|
||||
RawUserBookmark,
|
||||
r#"
|
||||
SELECT
|
||||
b.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,
|
||||
|
||||
b.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,
|
||||
b.entity_token,
|
||||
|
||||
b.user_token as `user_token: tokens::tokens::users::UserToken`,
|
||||
|
||||
es.bookmark_count as unused_bookmark_count,
|
||||
|
||||
b.created_at,
|
||||
b.updated_at,
|
||||
b.deleted_at
|
||||
|
||||
FROM
|
||||
user_bookmarks AS b
|
||||
|
||||
LEFT OUTER JOIN entity_stats AS es
|
||||
ON b.entity_type = es.entity_type
|
||||
AND b.entity_token = es.entity_token
|
||||
WHERE
|
||||
b.entity_type = ?
|
||||
AND b.entity_token = ?
|
||||
FOR UPDATE
|
||||
"#,
|
||||
entity_type.to_str(),
|
||||
entity_token
|
||||
)
|
||||
.fetch_one(mysql_executor)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn query_by_bookmark_token<'e, 'c, E>(mysql_executor: E, bookmark_token: &UserBookmarkToken)
|
||||
-> Result<RawUserBookmark, Error> where E: 'e + Executor<'c, Database=MySql>
|
||||
{
|
||||
// NB(1): LEFT OUTER JOIN does not require entity_stats to be present, but will lock it under
|
||||
// SELECT...FOR UPDATE if the row exists.
|
||||
// NB(2): We're joining the record against itself to lock on (entity_type,entity_token)
|
||||
sqlx::query_as!(
|
||||
RawUserBookmark,
|
||||
r#"
|
||||
SELECT
|
||||
b2.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,
|
||||
|
||||
b2.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,
|
||||
b2.entity_token,
|
||||
|
||||
b2.user_token as `user_token: tokens::tokens::users::UserToken`,
|
||||
|
||||
es.bookmark_count as unused_bookmark_count,
|
||||
|
||||
b2.created_at,
|
||||
b2.updated_at,
|
||||
b2.deleted_at
|
||||
|
||||
FROM
|
||||
user_bookmarks AS b1
|
||||
|
||||
JOIN user_bookmarks as b2
|
||||
ON b1.entity_type = b2.entity_type
|
||||
AND b1.entity_token = b2.entity_token
|
||||
|
||||
LEFT OUTER JOIN entity_stats AS es
|
||||
ON b1.entity_type = es.entity_type
|
||||
AND b1.entity_token = es.entity_token
|
||||
|
||||
WHERE
|
||||
b1.token = ?
|
||||
|
||||
FOR UPDATE
|
||||
"#,
|
||||
bookmark_token
|
||||
)
|
||||
.fetch_one(mysql_executor)
|
||||
.await
|
||||
}
|
||||
|
||||
pub struct RawUserBookmark {
|
||||
pub token: UserBookmarkToken,
|
||||
|
||||
pub entity_type: UserBookmarkEntityType,
|
||||
pub entity_token: String,
|
||||
|
||||
pub user_token: UserToken,
|
||||
|
||||
// NB: Not used, just for dual transactional locking.
|
||||
pub unused_bookmark_count: Option<u32>,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
@@ -1,28 +1,48 @@
|
||||
use anyhow::anyhow;
|
||||
use log::warn;
|
||||
use sqlx::MySqlPool;
|
||||
use sqlx::{MySql, MySqlPool, QueryBuilder};
|
||||
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::queries::user_bookmarks::list_user_bookmarks_result::RawUserBookmarkRecord;
|
||||
use crate::queries::user_bookmarks::list_user_bookmarks_result::UserBookmark;
|
||||
|
||||
pub async fn list_user_bookmarks(
|
||||
username: &str,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<Vec<UserBookmark>> {
|
||||
pub struct UserBookmarkListPage {
|
||||
pub results: Vec<UserBookmark>,
|
||||
|
||||
/// TODO(bt,2023-11-21): Maybe this query can use a switch
|
||||
/// See: https://stackoverflow.com/questions/2761574/mysql-use-case-else-value-as-join-parameter
|
||||
let maybe_results= sqlx::query_as!(
|
||||
RawUserBookmarkRecord,
|
||||
r#"
|
||||
SELECT
|
||||
f.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,
|
||||
f.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,
|
||||
pub sort_ascending: bool,
|
||||
|
||||
pub current_page: usize,
|
||||
pub total_page_count: usize,
|
||||
}
|
||||
|
||||
pub struct ListUserBookmarksForUserArgs<'a> {
|
||||
pub username: &'a str,
|
||||
pub maybe_filter_entity_type: Option<UserBookmarkEntityType>,
|
||||
pub maybe_filter_weight_type: Option<WeightsType>,
|
||||
pub maybe_filter_weight_category: Option<WeightsCategory>,
|
||||
pub maybe_filter_media_file_type: Option<MediaFileType>,
|
||||
pub page_size: usize,
|
||||
pub page_index: usize,
|
||||
pub sort_ascending: bool,
|
||||
pub mysql_pool: &'a MySqlPool,
|
||||
}
|
||||
|
||||
fn select_total_count_field() -> String {
|
||||
r#"
|
||||
COUNT(f.id) AS total_count
|
||||
"#
|
||||
.to_string()
|
||||
}
|
||||
|
||||
fn select_result_fields() -> &'static str {
|
||||
r#"
|
||||
f.token,
|
||||
f.entity_type,
|
||||
f.entity_token,
|
||||
f.user_token as `user_token: tokens::tokens::users::UserToken`,
|
||||
f.user_token,
|
||||
u.username,
|
||||
u.display_name as user_display_name,
|
||||
u.email_gravatar_hash as user_gravatar_hash,
|
||||
@@ -30,8 +50,25 @@ SELECT
|
||||
f.updated_at,
|
||||
f.deleted_at,
|
||||
|
||||
media_files.media_type as `maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType`,
|
||||
media_files.origin_product_category as `maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,
|
||||
media_files.media_type as maybe_media_file_type,
|
||||
media_files.origin_product_category as maybe_media_file_origin_category,
|
||||
media_files.public_bucket_directory_hash as maybe_media_file_public_bucket_hash,
|
||||
media_files.maybe_public_bucket_prefix as maybe_media_file_public_bucket_prefix,
|
||||
media_files.maybe_public_bucket_extension as maybe_media_file_public_bucket_extension,
|
||||
media_file_creator.token as maybe_media_file_creator_user_token,
|
||||
media_file_creator.username as maybe_media_file_creator_username,
|
||||
media_file_creator.display_name as maybe_media_file_creator_display_name,
|
||||
media_file_creator.email_gravatar_hash as maybe_media_file_creator_gravatar_hash,
|
||||
|
||||
model_weights.weights_type as maybe_model_weight_type,
|
||||
model_weights.weights_category as maybe_model_weight_category,
|
||||
media_file_cover_images.public_bucket_directory_hash as maybe_model_weight_cover_image_public_bucket_hash,
|
||||
media_file_cover_images.maybe_public_bucket_prefix as maybe_model_weight_cover_image_public_bucket_prefix,
|
||||
media_file_cover_images.maybe_public_bucket_extension as maybe_model_weight_cover_image_public_bucket_extension,
|
||||
model_weight_creator.token as maybe_model_weight_creator_user_token,
|
||||
model_weight_creator.username as maybe_model_weight_creator_username,
|
||||
model_weight_creator.display_name as maybe_model_weight_creator_display_name,
|
||||
model_weight_creator.email_gravatar_hash as maybe_model_weight_creator_gravatar_hash,
|
||||
|
||||
model_weights.title as maybe_descriptive_text_model_weight_title,
|
||||
tts_models.title as maybe_descriptive_text_tts_model_title,
|
||||
@@ -39,112 +76,173 @@ SELECT
|
||||
users.display_name as maybe_descriptive_text_user_display_name,
|
||||
voice_conversion_models.title as maybe_descriptive_text_voice_conversion_model_title,
|
||||
zs_voices.title as maybe_descriptive_text_zs_voice_title
|
||||
|
||||
FROM
|
||||
user_bookmarks AS f
|
||||
JOIN users AS u
|
||||
ON f.user_token = u.token
|
||||
|
||||
LEFT OUTER JOIN model_weights ON model_weights.token = f.entity_token
|
||||
LEFT OUTER JOIN media_files ON media_files.token = f.entity_token
|
||||
LEFT OUTER JOIN tts_models ON tts_models.token = f.entity_token
|
||||
LEFT OUTER JOIN tts_results ON tts_results.token = f.entity_token
|
||||
LEFT OUTER JOIN users ON users.token = f.entity_token
|
||||
LEFT OUTER JOIN voice_conversion_models ON voice_conversion_models.token = f.entity_token
|
||||
LEFT OUTER JOIN zs_voices ON zs_voices.token = f.entity_token
|
||||
|
||||
WHERE
|
||||
u.username = ?
|
||||
AND f.deleted_at IS NULL
|
||||
ORDER BY f.id DESC
|
||||
LIMIT 50
|
||||
"#,
|
||||
username
|
||||
)
|
||||
.fetch_all(mysql_pool)
|
||||
.await;
|
||||
|
||||
match maybe_results {
|
||||
Err(err) => match err {
|
||||
sqlx::Error::RowNotFound => Ok(Vec::new()),
|
||||
_ => {
|
||||
warn!("list user_bookmarks db error: {:?}", err);
|
||||
Err(anyhow!("error with query: {:?}", err))
|
||||
}
|
||||
},
|
||||
Ok(results) => Ok(results.into_iter()
|
||||
.map(|user_bookmark| user_bookmark.into_public_type())
|
||||
.collect()),
|
||||
}
|
||||
"#
|
||||
}
|
||||
|
||||
pub async fn list_user_user_bookmarks_by_entity_type(
|
||||
username: &str,
|
||||
entity_type: UserBookmarkEntityType,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<Vec<UserBookmark>> {
|
||||
fn query_builder<'a>(
|
||||
maybe_filter_entity_type: Option<UserBookmarkEntityType>,
|
||||
maybe_filter_weight_type: Option<WeightsType>,
|
||||
maybe_filter_weight_category: Option<WeightsCategory>,
|
||||
maybe_filter_media_file_type: Option<MediaFileType>,
|
||||
maybe_username: Option<&'a str>,
|
||||
enforce_limits: bool,
|
||||
page_index: usize,
|
||||
page_size: usize,
|
||||
sort_ascending: bool,
|
||||
select_fields: &'a str,
|
||||
) -> QueryBuilder<'a, MySql> {
|
||||
|
||||
let maybe_results= sqlx::query_as!(
|
||||
RawUserBookmarkRecord,
|
||||
r#"
|
||||
let mut first_predicate_added = false;
|
||||
// NB: Query cannot be statically checked by sqlx
|
||||
let mut query_builder: QueryBuilder<MySql> = QueryBuilder::new(
|
||||
format!(r#"
|
||||
SELECT
|
||||
f.token as `token: tokens::tokens::user_bookmarks::UserBookmarkToken`,
|
||||
f.entity_type as `entity_type: enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType`,
|
||||
f.entity_token,
|
||||
f.user_token as `user_token: tokens::tokens::users::UserToken`,
|
||||
u.username,
|
||||
u.display_name as user_display_name,
|
||||
u.email_gravatar_hash as user_gravatar_hash,
|
||||
f.created_at,
|
||||
f.updated_at,
|
||||
f.deleted_at,
|
||||
|
||||
media_files.media_type as `maybe_media_file_type: enums::by_table::media_files::media_file_type::MediaFileType`,
|
||||
media_files.origin_product_category as `maybe_media_file_origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,
|
||||
|
||||
model_weights.title as maybe_descriptive_text_model_weight_title,
|
||||
tts_models.title as maybe_descriptive_text_tts_model_title,
|
||||
tts_results.raw_inference_text as maybe_descriptive_text_tts_result_inference_text,
|
||||
users.display_name as maybe_descriptive_text_user_display_name,
|
||||
voice_conversion_models.title as maybe_descriptive_text_voice_conversion_model_title,
|
||||
zs_voices.title as maybe_descriptive_text_zs_voice_title
|
||||
|
||||
{select_fields}
|
||||
FROM
|
||||
user_bookmarks AS f
|
||||
JOIN users AS u
|
||||
ON f.user_token = u.token
|
||||
|
||||
LEFT OUTER JOIN model_weights ON model_weights.token = f.entity_token
|
||||
LEFT OUTER JOIN media_files AS media_file_cover_images
|
||||
ON model_weights.maybe_cover_image_media_file_token = media_file_cover_images.token
|
||||
LEFT OUTER JOIN users as model_weight_creator
|
||||
ON model_weights.creator_user_token = model_weight_creator.token
|
||||
|
||||
LEFT OUTER JOIN media_files ON media_files.token = f.entity_token
|
||||
LEFT OUTER JOIN users as media_file_creator
|
||||
ON media_files.maybe_creator_user_token = media_file_creator.token
|
||||
|
||||
LEFT OUTER JOIN tts_models ON tts_models.token = f.entity_token
|
||||
LEFT OUTER JOIN tts_results ON tts_results.token = f.entity_token
|
||||
LEFT OUTER JOIN users ON users.token = f.entity_token
|
||||
LEFT OUTER JOIN voice_conversion_models ON voice_conversion_models.token = f.entity_token
|
||||
LEFT OUTER JOIN zs_voices ON zs_voices.token = f.entity_token
|
||||
|
||||
WHERE
|
||||
u.username = ?
|
||||
AND f.entity_type = ?
|
||||
AND f.deleted_at IS NULL
|
||||
ORDER BY f.id DESC
|
||||
LIMIT 50
|
||||
"#,
|
||||
username,
|
||||
entity_type
|
||||
)
|
||||
.fetch_all(mysql_pool)
|
||||
.await;
|
||||
"#
|
||||
));
|
||||
|
||||
match maybe_results {
|
||||
Err(err) => match err {
|
||||
sqlx::Error::RowNotFound => Ok(Vec::new()),
|
||||
_ => {
|
||||
warn!("list user_bookmarks db error: {:?}", err);
|
||||
Err(anyhow!("error with query: {:?}", err))
|
||||
}
|
||||
},
|
||||
Ok(results) => Ok(results.into_iter()
|
||||
.map(|user_bookmark| user_bookmark.into_public_type())
|
||||
.collect()),
|
||||
}
|
||||
if let Some(username) = maybe_username {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
query_builder.push(" u.username = ");
|
||||
query_builder.push_bind(username);
|
||||
}
|
||||
|
||||
if let Some(entity_type) = maybe_filter_entity_type {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
query_builder.push(" f.entity_type = ");
|
||||
query_builder.push_bind(entity_type.to_str());
|
||||
}
|
||||
|
||||
if let Some(weights_type) = maybe_filter_weight_type {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
query_builder.push(" model_weights.weights_type = ");
|
||||
query_builder.push_bind(weights_type.to_str());
|
||||
}
|
||||
|
||||
if let Some(weights_category) = maybe_filter_weight_category {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
query_builder.push(" model_weights.weights_category = ");
|
||||
query_builder.push_bind(weights_category.to_str());
|
||||
}
|
||||
|
||||
if let Some(media_file_type) = maybe_filter_media_file_type {
|
||||
if !first_predicate_added {
|
||||
query_builder.push(" WHERE ");
|
||||
first_predicate_added = true;
|
||||
} else {
|
||||
query_builder.push(" AND ");
|
||||
}
|
||||
query_builder.push(" media_files.media_type = ");
|
||||
query_builder.push_bind(media_file_type.to_str());
|
||||
}
|
||||
|
||||
query_builder.push(" AND f.deleted_at IS NULL ");
|
||||
|
||||
if sort_ascending {
|
||||
query_builder.push(" ORDER BY f.created_at ASC ");
|
||||
} else {
|
||||
query_builder.push(" ORDER BY f.created_at DESC ");
|
||||
}
|
||||
|
||||
if enforce_limits {
|
||||
let offset = page_index * page_size;
|
||||
query_builder.push(format!(" LIMIT {page_size} OFFSET {offset} "));
|
||||
}
|
||||
|
||||
query_builder
|
||||
}
|
||||
|
||||
pub async fn list_user_bookmarks_by_maybe_entity_type(
|
||||
args: ListUserBookmarksForUserArgs<'_>
|
||||
) -> AnyhowResult<UserBookmarkListPage> {
|
||||
|
||||
let count_fields = select_total_count_field();
|
||||
let mut count_query_builder = query_builder(
|
||||
args.maybe_filter_entity_type,
|
||||
args.maybe_filter_weight_type,
|
||||
args.maybe_filter_weight_category,
|
||||
args.maybe_filter_media_file_type,
|
||||
Some(args.username),
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
args.sort_ascending,
|
||||
count_fields.as_str(),
|
||||
);
|
||||
|
||||
let row_count_query = count_query_builder.build_query_scalar::<i64>();
|
||||
let row_count_result = row_count_query.fetch_one(args.mysql_pool).await?;
|
||||
|
||||
/// Now fetch the actual results with all the fields
|
||||
let result_fields = select_result_fields();
|
||||
let mut query = query_builder(
|
||||
args.maybe_filter_entity_type,
|
||||
args.maybe_filter_weight_type,
|
||||
args.maybe_filter_weight_category,
|
||||
args.maybe_filter_media_file_type,
|
||||
Some(args.username),
|
||||
true,
|
||||
args.page_index,
|
||||
args.page_size,
|
||||
args.sort_ascending,
|
||||
result_fields,
|
||||
);
|
||||
|
||||
let query = query.build_query_as::<RawUserBookmarkRecord>();
|
||||
let results = query.fetch_all(args.mysql_pool).await?;
|
||||
|
||||
let number_of_pages = (row_count_result / args.page_size as i64) as usize;
|
||||
let results = results.into_iter()
|
||||
.map(|record| {
|
||||
record.into_public_type()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Ok(UserBookmarkListPage {
|
||||
results,
|
||||
sort_ascending: args.sort_ascending,
|
||||
current_page: args.page_index,
|
||||
total_page_count: number_of_pages,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use sqlx::{FromRow, Row};
|
||||
use sqlx::mysql::MySqlRow;
|
||||
|
||||
use enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType;
|
||||
use enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory;
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType;
|
||||
use enums::traits::mysql_from_row::MySqlFromRow;
|
||||
use tokens::tokens::user_bookmarks::UserBookmarkToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
@@ -12,10 +17,42 @@ pub struct UserBookmark {
|
||||
pub entity_type: UserBookmarkEntityType,
|
||||
pub entity_token: String,
|
||||
|
||||
pub maybe_media_file_type: Option<MediaFileType>,
|
||||
pub maybe_media_file_public_bucket_hash: Option<String>,
|
||||
pub maybe_media_file_public_bucket_prefix: Option<String>,
|
||||
pub maybe_media_file_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_media_file_creator_user_token: Option<UserToken>,
|
||||
pub maybe_media_file_creator_username: Option<String>,
|
||||
pub maybe_media_file_creator_display_name: Option<String>,
|
||||
pub maybe_media_file_creator_gravatar_hash: Option<String>,
|
||||
|
||||
/// Something descriptive about the bookmarked entity.
|
||||
/// This might be TTS text, a username, etc. It depends on the entity type.
|
||||
pub maybe_entity_descriptive_text: Option<String>,
|
||||
|
||||
/// Only set if the bookmark is of a model_weights record.
|
||||
pub maybe_model_weight_type: Option<WeightsType>,
|
||||
|
||||
/// Only set if the bookmark is of a model_weights record.
|
||||
pub maybe_model_weight_category: Option<WeightsCategory>,
|
||||
|
||||
/// Only set if the bookmark is of a media_files record *AND* the model has a cover image.
|
||||
pub maybe_model_weight_cover_image_public_bucket_hash: Option<String>,
|
||||
|
||||
/// Only set if the bookmark is of a media_files record *AND* the model has a cover image.
|
||||
|
||||
pub maybe_model_weight_cover_image_public_bucket_prefix: Option<String>,
|
||||
|
||||
/// Only set if the bookmark is of a media_files record *AND* the model has a cover image.
|
||||
pub maybe_model_weight_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_model_weight_creator_user_token: Option<UserToken>,
|
||||
pub maybe_model_weight_creator_username: Option<String>,
|
||||
pub maybe_model_weight_creator_display_name: Option<String>,
|
||||
pub maybe_model_weight_creator_gravatar_hash: Option<String>,
|
||||
|
||||
// TODO(bt,2023-12-30): I don't think these user fields are necessary.
|
||||
pub user_token: UserToken,
|
||||
pub username: String,
|
||||
pub user_display_name: String,
|
||||
@@ -32,6 +69,7 @@ pub struct RawUserBookmarkRecord {
|
||||
pub (crate) entity_type: UserBookmarkEntityType,
|
||||
pub (crate) entity_token: String,
|
||||
|
||||
// TODO(bt,2023-12-30): I don't think these user fields are necessary.
|
||||
pub (crate) user_token: UserToken,
|
||||
pub (crate) username: String,
|
||||
pub (crate) user_display_name: String,
|
||||
@@ -43,6 +81,26 @@ pub struct RawUserBookmarkRecord {
|
||||
|
||||
pub (crate) maybe_media_file_type: Option<MediaFileType>,
|
||||
pub (crate) maybe_media_file_origin_category: Option<MediaFileOriginCategory>,
|
||||
pub (crate) maybe_media_file_public_bucket_hash: Option<String>,
|
||||
pub (crate) maybe_media_file_public_bucket_prefix: Option<String>,
|
||||
pub (crate) maybe_media_file_public_bucket_extension: Option<String>,
|
||||
|
||||
pub (crate) maybe_media_file_creator_user_token: Option<UserToken>,
|
||||
pub (crate) maybe_media_file_creator_username: Option<String>,
|
||||
pub (crate) maybe_media_file_creator_display_name: Option<String>,
|
||||
pub (crate) maybe_media_file_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub (crate) maybe_model_weight_type: Option<WeightsType>,
|
||||
pub (crate) maybe_model_weight_category: Option<WeightsCategory>,
|
||||
|
||||
pub (crate) maybe_model_weight_cover_image_public_bucket_hash: Option<String>,
|
||||
pub (crate) maybe_model_weight_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub (crate) maybe_model_weight_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub (crate) maybe_model_weight_creator_user_token: Option<UserToken>,
|
||||
pub (crate) maybe_model_weight_creator_username: Option<String>,
|
||||
pub (crate) maybe_model_weight_creator_display_name: Option<String>,
|
||||
pub (crate) maybe_model_weight_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub (crate) maybe_descriptive_text_model_weight_title: Option<String>,
|
||||
pub (crate) maybe_descriptive_text_tts_model_title: Option<String>,
|
||||
@@ -58,6 +116,14 @@ impl RawUserBookmarkRecord {
|
||||
token: self.token,
|
||||
entity_type: self.entity_type,
|
||||
entity_token: self.entity_token,
|
||||
maybe_media_file_type: self.maybe_media_file_type,
|
||||
maybe_media_file_public_bucket_hash: self.maybe_media_file_public_bucket_hash,
|
||||
maybe_media_file_public_bucket_prefix: self.maybe_media_file_public_bucket_prefix,
|
||||
maybe_media_file_public_bucket_extension: self.maybe_media_file_public_bucket_extension,
|
||||
maybe_media_file_creator_user_token: self.maybe_media_file_creator_user_token,
|
||||
maybe_media_file_creator_username: self.maybe_media_file_creator_username,
|
||||
maybe_media_file_creator_display_name: self.maybe_media_file_creator_display_name,
|
||||
maybe_media_file_creator_gravatar_hash: self.maybe_media_file_creator_gravatar_hash,
|
||||
maybe_entity_descriptive_text: match self.entity_type {
|
||||
UserBookmarkEntityType::User => self.maybe_descriptive_text_user_display_name,
|
||||
UserBookmarkEntityType::ModelWeight => self.maybe_descriptive_text_model_weight_title,
|
||||
@@ -75,6 +141,15 @@ impl RawUserBookmarkRecord {
|
||||
UserBookmarkEntityType::VoiceConversionModel => self.maybe_descriptive_text_voice_conversion_model_title,
|
||||
UserBookmarkEntityType::ZsVoice => self.maybe_descriptive_text_zs_voice_title,
|
||||
},
|
||||
maybe_model_weight_type: self.maybe_model_weight_type,
|
||||
maybe_model_weight_category: self.maybe_model_weight_category,
|
||||
maybe_model_weight_cover_image_public_bucket_hash: self.maybe_model_weight_cover_image_public_bucket_hash,
|
||||
maybe_model_weight_cover_image_public_bucket_prefix: self.maybe_model_weight_cover_image_public_bucket_prefix,
|
||||
maybe_model_weight_cover_image_public_bucket_extension: self.maybe_model_weight_cover_image_public_bucket_extension,
|
||||
maybe_model_weight_creator_user_token: self.maybe_model_weight_creator_user_token,
|
||||
maybe_model_weight_creator_username: self.maybe_model_weight_creator_username,
|
||||
maybe_model_weight_creator_display_name: self.maybe_model_weight_creator_display_name,
|
||||
maybe_model_weight_creator_gravatar_hash: self.maybe_model_weight_creator_gravatar_hash,
|
||||
user_token: self.user_token,
|
||||
username: self.username,
|
||||
user_display_name: self.user_display_name,
|
||||
@@ -85,3 +160,44 @@ impl RawUserBookmarkRecord {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromRow<'_, MySqlRow> for RawUserBookmarkRecord {
|
||||
fn from_row(row: &MySqlRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self {
|
||||
token: UserBookmarkToken::new(row.try_get("token")?),
|
||||
entity_type: UserBookmarkEntityType::try_from_mysql_row(row, "entity_type")?,
|
||||
entity_token: row.try_get("entity_token")?,
|
||||
user_token: row.try_get("user_token")?,
|
||||
username: row.try_get("username")?,
|
||||
user_display_name: row.try_get("user_display_name")?,
|
||||
user_gravatar_hash: row.try_get("user_gravatar_hash")?,
|
||||
created_at: row.try_get("created_at")?,
|
||||
updated_at: row.try_get("updated_at")?,
|
||||
deleted_at: row.try_get("deleted_at")?,
|
||||
maybe_media_file_type: MediaFileType::try_from_mysql_row_nullable(row,"maybe_media_file_type")?,
|
||||
maybe_media_file_origin_category: MediaFileOriginCategory::try_from_mysql_row_nullable(row,"maybe_media_file_origin_category")?,
|
||||
maybe_media_file_public_bucket_hash: row.try_get("maybe_media_file_public_bucket_hash")?,
|
||||
maybe_media_file_public_bucket_prefix: row.try_get("maybe_media_file_public_bucket_prefix")?,
|
||||
maybe_media_file_public_bucket_extension: row.try_get("maybe_media_file_public_bucket_extension")?,
|
||||
maybe_media_file_creator_user_token: row.try_get("maybe_media_file_creator_user_token")?,
|
||||
maybe_media_file_creator_username: row.try_get("maybe_media_file_creator_username")?,
|
||||
maybe_media_file_creator_display_name: row.try_get("maybe_media_file_creator_display_name")?,
|
||||
maybe_media_file_creator_gravatar_hash: row.try_get("maybe_media_file_creator_gravatar_hash")?,
|
||||
maybe_model_weight_type: WeightsType::try_from_mysql_row_nullable(row, "maybe_model_weight_type")?,
|
||||
maybe_model_weight_category: WeightsCategory::try_from_mysql_row_nullable(row, "maybe_model_weight_category")?,
|
||||
maybe_model_weight_cover_image_public_bucket_hash: row.try_get("maybe_model_weight_cover_image_public_bucket_hash")?,
|
||||
maybe_model_weight_cover_image_public_bucket_prefix: row.try_get("maybe_model_weight_cover_image_public_bucket_prefix")?,
|
||||
maybe_model_weight_cover_image_public_bucket_extension: row.try_get("maybe_model_weight_cover_image_public_bucket_extension")?,
|
||||
maybe_model_weight_creator_user_token: row.try_get("maybe_model_weight_creator_user_token")?,
|
||||
maybe_model_weight_creator_username: row.try_get("maybe_model_weight_creator_username")?,
|
||||
maybe_model_weight_creator_display_name: row.try_get("maybe_model_weight_creator_display_name")?,
|
||||
maybe_model_weight_creator_gravatar_hash: row.try_get("maybe_model_weight_creator_gravatar_hash")?,
|
||||
maybe_descriptive_text_model_weight_title: row.try_get("maybe_descriptive_text_model_weight_title")?,
|
||||
maybe_descriptive_text_tts_model_title: row.try_get("maybe_descriptive_text_tts_model_title")?,
|
||||
maybe_descriptive_text_tts_result_inference_text: row.try_get("maybe_descriptive_text_tts_result_inference_text")?,
|
||||
maybe_descriptive_text_user_display_name: row.try_get("maybe_descriptive_text_user_display_name")?,
|
||||
maybe_descriptive_text_voice_conversion_model_title: row.try_get("maybe_descriptive_text_voice_conversion_model_title")?,
|
||||
maybe_descriptive_text_zs_voice_title: row.try_get("maybe_descriptive_text_zs_voice_title")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user