mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-08 19:11:29 +00:00
query builder quickfix
This commit is contained in:
1 parent
8e4f419091
commit
dcbdaf9cd6
2 files changed
+25
-13
No files matched your search
@@ -1,4 +1,3 @@
|
||||
use std::os::linux::raw;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use chrono::{ DateTime, Utc };
|
||||
|
||||
@@ -178,8 +178,19 @@ impl ListWeightsQueryBuilder {
|
||||
query = query.bind(username);
|
||||
}
|
||||
|
||||
if let Some(weights_type) = self.weights_type {
|
||||
query = query.bind(weights_type);
|
||||
}
|
||||
|
||||
if let Some(weights_category) = self.weights_category {
|
||||
query = query.bind(weights_category);
|
||||
}
|
||||
|
||||
query = query.bind(self.limit);
|
||||
|
||||
|
||||
// debug!("query: {:?}", query);
|
||||
// panic!("query: {:?}", query)
|
||||
let mut results = query.fetch_all(mysql_pool)
|
||||
.await?;
|
||||
|
||||
@@ -210,16 +221,18 @@ impl ListWeightsQueryBuilder {
|
||||
WeightJoinUser {
|
||||
weight_id:record.weight_id,
|
||||
token:record.token,
|
||||
weights_type:record.weights_type,
|
||||
weights_category:record.weights_category,
|
||||
weights_type:
|
||||
WeightsType::from_str(record.weights_type.as_str()).unwrap(),
|
||||
weights_category:WeightsCategory::from_str(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,
|
||||
creator_user_token:record.creator_user_token,
|
||||
creator_user_token: UserToken::new_from_str( &record.creator_user_token),
|
||||
creator_ip_address:record.creator_ip_address,
|
||||
creator_set_visibility: record.creator_set_visibility,
|
||||
maybe_last_update_user_token:record.maybe_last_update_user_token,
|
||||
creator_set_visibility: Visibility::from_str(&record.creator_set_visibility).unwrap(),
|
||||
maybe_last_update_user_token:
|
||||
record.maybe_last_update_user_token.map(|token| UserToken::new_from_str(&token)),
|
||||
original_download_url:record.original_download_url,
|
||||
original_filename:record.original_filename,
|
||||
file_size_bytes:record.file_size_bytes,
|
||||
@@ -289,7 +302,7 @@ impl ListWeightsQueryBuilder {
|
||||
users.email_gravatar_hash AS creator_email_gravatar_hash
|
||||
FROM model_weights
|
||||
JOIN users
|
||||
ON users.token = mw.maybe_creator_user_token
|
||||
ON users.token = model_weights.creator_user_token
|
||||
"#.to_string();
|
||||
|
||||
query.push_str(&self.build_predicates());
|
||||
@@ -404,8 +417,8 @@ struct RawWeightJoinUser {
|
||||
pub weight_id: i64,
|
||||
pub token: ModelWeightToken,
|
||||
|
||||
pub weights_type: WeightsType,
|
||||
pub weights_category: WeightsCategory,
|
||||
pub weights_type: String,
|
||||
pub weights_category: String,
|
||||
|
||||
pub title: String,
|
||||
|
||||
@@ -414,11 +427,11 @@ struct RawWeightJoinUser {
|
||||
pub description_markdown: String,
|
||||
pub description_rendered_html: String,
|
||||
|
||||
pub creator_user_token: UserToken,
|
||||
pub creator_user_token: String,
|
||||
pub creator_ip_address: String,
|
||||
pub creator_set_visibility: Visibility,
|
||||
|
||||
pub maybe_last_update_user_token: Option<UserToken>,
|
||||
pub creator_set_visibility: String,
|
||||
|
||||
pub maybe_last_update_user_token: Option<String>,
|
||||
|
||||
pub original_download_url: Option<String>,
|
||||
pub original_filename: Option<String>,
|
||||
|
||||
Reference in new issue
Block a user