add to another endpoint (get)

This commit is contained in:
Brandon Thomas committed 2022-03-01 04:32:13 -05:00
1 parent 41d5526c50
commit a976d3e84d
2 files changed
+25 -1

No files matched your search

@@ -10,6 +10,7 @@ use sqlx::MySqlPool;
// FIXME: This is the old style of query scoping and shouldn't be copied.
// The moderator-only fields are good practice, though.
// TODO/FIXME : This struct is returned publicly in some endpoints!
#[derive(Serialize)]
pub struct TtsModelRecordForResponse {
pub model_token: String,
@@ -26,9 +27,14 @@ pub struct TtsModelRecordForResponse {
pub description_markdown: String,
pub description_rendered_html: String,
pub ietf_language_tag: String,
pub ietf_primary_language_subtag: String,
pub is_front_page_featured: bool,
pub is_twitch_featured: bool,
pub maybe_suggested_unique_bot_command: Option<String>,
pub creator_set_visibility: RecordVisibility,
pub is_locked_from_use: bool,
@@ -100,8 +106,11 @@ pub async fn get_tts_model_by_token(
description_markdown: model.description_markdown,
description_rendered_html: model.description_rendered_html,
// NB: Fail open/public with creator_set_visibility since we're already looking at it
ietf_language_tag: model.ietf_language_tag,
ietf_primary_language_subtag: model.ietf_primary_language_subtag,
is_front_page_featured: i8_to_bool(model.is_front_page_featured),
is_twitch_featured: i8_to_bool(model.is_twitch_featured),
maybe_suggested_unique_bot_command: model.maybe_suggested_unique_bot_command,
creator_set_visibility: RecordVisibility::from_str(&model.creator_set_visibility)
.unwrap_or(RecordVisibility::Public),
is_locked_from_use: i8_to_bool(model.is_locked_from_use),
@@ -143,9 +152,14 @@ SELECT
tts.description_markdown,
tts.description_rendered_html,
tts.ietf_language_tag,
tts.ietf_primary_language_subtag,
tts.is_front_page_featured,
tts.is_twitch_featured,
tts.maybe_suggested_unique_bot_command,
tts.creator_set_visibility,
tts.is_locked_from_use,
@@ -193,8 +207,13 @@ SELECT
tts.description_markdown,
tts.description_rendered_html,
tts.ietf_language_tag,
tts.ietf_primary_language_subtag,
tts.is_front_page_featured,
tts.is_twitch_featured,
tts.maybe_suggested_unique_bot_command,
tts.creator_set_visibility,
@@ -240,9 +259,14 @@ struct InternalTtsModelRecordRaw {
pub description_markdown: String,
pub description_rendered_html: String,
pub ietf_language_tag: String,
pub ietf_primary_language_subtag: String,
pub is_front_page_featured: i8,
pub is_twitch_featured: i8,
pub maybe_suggested_unique_bot_command: Option<String>,
pub creator_set_visibility: String,
pub is_locked_from_use: i8,
@@ -7,7 +7,7 @@ use sqlx::MySqlPool;
// FIXME: This is the old style of query scoping and shouldn't be copied.
// TODO: This record type is publicly returned in some endpoints!
// TODO/FIXME : This struct is returned publicly in some endpoints!
#[derive(Serialize)]
pub struct TtsModelRecordForList {
pub model_token: String,