mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 00:47:53 +00:00
fixed errors on one endpoint
This commit is contained in:
1 parent
a9aa0a5b50
commit
3022193ff7
1 file changed
+43
-56
@@ -35,31 +35,28 @@ pub struct GetTtsResultPathInfo {
|
||||
#[derive(Serialize)]
|
||||
pub struct TtsResultRecordForResponse {
|
||||
pub tts_result_token: String,
|
||||
pub maybe_tts_model_token: Option<String>,
|
||||
pub maybe_tts_inference_result_token: Option<String>,
|
||||
|
||||
pub public_bucket_video_path: String,
|
||||
|
||||
pub template_type: Option<String>,
|
||||
pub template_title: Option<String>,
|
||||
pub tts_model_token: String,
|
||||
pub inference_text: String,
|
||||
|
||||
pub maybe_creator_user_token: Option<String>,
|
||||
pub maybe_creator_username: Option<String>,
|
||||
pub maybe_creator_display_name: Option<String>,
|
||||
pub maybe_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub maybe_template_creator_user_token: Option<String>,
|
||||
pub maybe_template_creator_username: Option<String>,
|
||||
pub maybe_template_creator_display_name: Option<String>,
|
||||
pub maybe_template_creator_gravatar_hash: Option<String>,
|
||||
pub maybe_model_creator_user_token: Option<String>,
|
||||
pub maybe_model_creator_username: Option<String>,
|
||||
pub maybe_model_creator_display_name: Option<String>,
|
||||
pub maybe_model_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub public_bucket_wav_audio_path: String,
|
||||
pub public_bucket_spectrogram_path: String,
|
||||
|
||||
pub file_size_bytes: u32,
|
||||
pub frame_width: u32,
|
||||
pub frame_height: u32,
|
||||
pub duration_millis: u32,
|
||||
|
||||
//pub is_mod_hidden_from_public: bool, // converted
|
||||
//pub template_is_mod_approved: bool, // converted
|
||||
//pub model_is_mod_approved: bool, // converted
|
||||
//pub maybe_mod_user_token: Option<String>,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
@@ -86,31 +83,27 @@ pub enum GetTtsResultError {
|
||||
pub struct RawTtsResultRecord {
|
||||
pub tts_result_token: String, // from field `tts_results.token`
|
||||
|
||||
pub maybe_tts_model_token: Option<String>,
|
||||
pub maybe_tts_inference_result_token: Option<String>,
|
||||
|
||||
pub public_bucket_video_path: String,
|
||||
|
||||
pub template_type: Option<String>,
|
||||
pub template_title: Option<String>, // from field `tts_models.title`
|
||||
pub tts_model_token: String,
|
||||
pub inference_text: String,
|
||||
|
||||
pub maybe_creator_user_token: Option<String>,
|
||||
pub maybe_creator_username: Option<String>,
|
||||
pub maybe_creator_display_name: Option<String>,
|
||||
pub maybe_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub maybe_template_creator_user_token: Option<String>,
|
||||
pub maybe_template_creator_username: Option<String>,
|
||||
pub maybe_template_creator_display_name: Option<String>,
|
||||
pub maybe_template_creator_gravatar_hash: Option<String>,
|
||||
pub maybe_model_creator_user_token: Option<String>,
|
||||
pub maybe_model_creator_username: Option<String>,
|
||||
pub maybe_model_creator_display_name: Option<String>,
|
||||
pub maybe_model_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub public_bucket_wav_audio_path: String,
|
||||
pub public_bucket_spectrogram_path: String,
|
||||
|
||||
pub file_size_bytes: i32,
|
||||
pub frame_width: i32,
|
||||
pub frame_height: i32,
|
||||
pub duration_millis: i32,
|
||||
|
||||
//pub is_mod_hidden_from_public: i8, // needs convert
|
||||
//pub template_is_mod_approved: i8, // needs convert
|
||||
//pub model_is_mod_approved: i8, // needs convert
|
||||
//pub maybe_mod_user_token: Option<String>,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
@@ -157,38 +150,35 @@ pub async fn get_tts_inference_result_handler(
|
||||
r#"
|
||||
SELECT
|
||||
tts_results.token as tts_result_token,
|
||||
tts_results.maybe_tts_inference_result_token,
|
||||
|
||||
tts_results.public_bucket_video_path,
|
||||
|
||||
tts_models.token as maybe_tts_model_token,
|
||||
tts_models.template_type,
|
||||
tts_models.title as template_title,
|
||||
tts_results.model_token as tts_model_token,
|
||||
tts_results.inference_text,
|
||||
|
||||
users.token as maybe_creator_user_token,
|
||||
users.username as maybe_creator_username,
|
||||
users.display_name as maybe_creator_display_name,
|
||||
users.email_gravatar_hash as maybe_creator_gravatar_hash,
|
||||
|
||||
template_users.token as maybe_template_creator_user_token,
|
||||
template_users.username as maybe_template_creator_username,
|
||||
template_users.display_name as maybe_template_creator_display_name,
|
||||
template_users.email_gravatar_hash as maybe_template_creator_gravatar_hash,
|
||||
model_users.token as maybe_model_creator_user_token,
|
||||
model_users.username as maybe_model_creator_username,
|
||||
model_users.display_name as maybe_model_creator_display_name,
|
||||
model_users.email_gravatar_hash as maybe_model_creator_gravatar_hash,
|
||||
|
||||
tts_results.public_bucket_wav_audio_path,
|
||||
tts_results.public_bucket_spectrogram_path,
|
||||
|
||||
tts_results.file_size_bytes,
|
||||
tts_results.frame_width,
|
||||
tts_results.frame_height,
|
||||
tts_results.duration_millis,
|
||||
tts_results.created_at,
|
||||
tts_results.updated_at
|
||||
|
||||
FROM tts_results
|
||||
LEFT OUTER JOIN tts_models
|
||||
ON tts_results.maybe_tts_model_token = tts_models.token
|
||||
ON tts_results.model_token = tts_models.token
|
||||
LEFT OUTER JOIN users
|
||||
ON tts_results.maybe_creator_user_token = users.token
|
||||
LEFT OUTER JOIN users as template_users
|
||||
ON tts_models.creator_user_token = template_users.token
|
||||
LEFT OUTER JOIN users as model_users
|
||||
ON tts_models.creator_user_token = model_users.token
|
||||
WHERE
|
||||
tts_results.deleted_at IS NULL
|
||||
AND tts_results.token = ?
|
||||
@@ -206,7 +196,7 @@ WHERE
|
||||
return Err(GetTtsResultError::ServerError);
|
||||
},
|
||||
_ => {
|
||||
warn!("w2l inference result query error: {:?}", err);
|
||||
warn!("tts inference result query error: {:?}", err);
|
||||
return Err(GetTtsResultError::ServerError);
|
||||
}
|
||||
}
|
||||
@@ -215,30 +205,27 @@ WHERE
|
||||
|
||||
let result_for_response = TtsResultRecordForResponse {
|
||||
tts_result_token: ir.tts_result_token.clone(),
|
||||
maybe_tts_model_token: ir.maybe_tts_model_token.clone(),
|
||||
maybe_tts_inference_result_token: ir.maybe_tts_inference_result_token.clone(),
|
||||
|
||||
public_bucket_video_path: ir.public_bucket_video_path.clone(),
|
||||
|
||||
template_type: ir.template_type.clone(),
|
||||
template_title: ir.template_title.clone(),
|
||||
tts_model_token: ir.tts_model_token.clone(),
|
||||
inference_text: ir.inference_text.clone(),
|
||||
|
||||
maybe_creator_user_token: ir.maybe_creator_user_token.clone(),
|
||||
maybe_creator_username: ir.maybe_creator_username.clone(),
|
||||
maybe_creator_display_name: ir.maybe_creator_display_name.clone(),
|
||||
maybe_creator_gravatar_hash: ir.maybe_creator_gravatar_hash.clone(),
|
||||
|
||||
maybe_template_creator_user_token: ir.maybe_template_creator_user_token.clone(),
|
||||
maybe_template_creator_username: ir.maybe_template_creator_username.clone(),
|
||||
maybe_template_creator_display_name: ir.maybe_template_creator_display_name.clone(),
|
||||
maybe_template_creator_gravatar_hash: ir.maybe_template_creator_gravatar_hash.clone(),
|
||||
maybe_model_creator_user_token: ir.maybe_model_creator_user_token.clone(),
|
||||
maybe_model_creator_username: ir.maybe_model_creator_username.clone(),
|
||||
maybe_model_creator_display_name: ir.maybe_model_creator_display_name.clone(),
|
||||
maybe_model_creator_gravatar_hash: ir.maybe_model_creator_gravatar_hash.clone(),
|
||||
|
||||
//is_mod_hidden_from_public: if ir.is_mod_hidden_from_public == 0 { false } else { true },
|
||||
//template_is_mod_approved: if ir.template_is_mod_approved == 0 { false } else { true },
|
||||
//model_is_mod_approved: if ir.model_is_mod_approved == 0 { false } else { true },
|
||||
|
||||
public_bucket_wav_audio_path: ir.public_bucket_wav_audio_path.clone(),
|
||||
public_bucket_spectrogram_path: ir.public_bucket_spectrogram_path.clone(),
|
||||
|
||||
file_size_bytes: if ir.file_size_bytes > 0 { ir.file_size_bytes as u32 } else { 0 },
|
||||
frame_width: if ir.frame_width > 0 { ir.frame_width as u32 } else { 0 },
|
||||
frame_height: if ir.frame_height > 0 { ir.frame_height as u32 } else { 0 },
|
||||
duration_millis: if ir.duration_millis > 0 { ir.duration_millis as u32 } else { 0 },
|
||||
|
||||
created_at: ir.created_at.clone(),
|
||||
|
||||
Reference in new issue
Block a user