mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-01 07:58:23 +00:00
remove config crate dep in mysql_queries
This commit is contained in:
1 parent
805765f302
commit
25df92c9ff
13 files changed
+65
-53
No files matched your search
Generated
-1
@@ -4375,7 +4375,6 @@ dependencies = [
|
||||
"buckets",
|
||||
"chrono",
|
||||
"composite_identifiers",
|
||||
"config",
|
||||
"dotenv",
|
||||
"enums",
|
||||
"errors",
|
||||
|
||||
@@ -20,7 +20,6 @@ normal = ["my-workspace-hack"]
|
||||
# Internal
|
||||
buckets = { path = "../../_types/buckets" }
|
||||
composite_identifiers = { path = "../../_types/composite_identifiers" }
|
||||
config = { path = "../deprecated/config" }
|
||||
enums = { path = "../../_types/enums" }
|
||||
errors = { path = "../errors" }
|
||||
idempotency = { path = "../idempotency" }
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pub mod shared_constants;
|
||||
@@ -0,0 +1,7 @@
|
||||
// TODO(bt,2024-06-28): Phase these out
|
||||
|
||||
/// The default MySql connection string for use in development
|
||||
pub const DEFAULT_MYSQL_CONNECTION_STRING: &str = "mysql://storyteller:password@localhost/storyteller";
|
||||
|
||||
/// The number of results we return by default for paginated queries.
|
||||
pub const DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE: u16 = 25;
|
||||
@@ -6,6 +6,7 @@ pub mod column_types;
|
||||
pub mod common_inputs;
|
||||
pub mod complex_models;
|
||||
pub mod composite_keys;
|
||||
pub mod config;
|
||||
pub mod helpers;
|
||||
pub mod mediators;
|
||||
pub mod payloads;
|
||||
|
||||
+1
-1
@@ -69,9 +69,9 @@ mod tests {
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
|
||||
use composite_identifiers::by_table::batch_generations::batch_generation_entity::BatchGenerationEntity;
|
||||
use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
|
||||
use crate::config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
use crate::queries::batch_generations::insert_batch_generation_records::{insert_batch_generation_records, InsertBatchArgs};
|
||||
|
||||
async fn setup() -> sqlx::Pool<sqlx::MySql> {
|
||||
|
||||
@@ -84,7 +84,7 @@ pub async fn insert_batch_beta_keys<'a, 'b>(args: InsertBatchArgs<'a>) -> Anyhow
|
||||
// use sqlx::mysql::MySqlPoolOptions;
|
||||
//
|
||||
// use composite_identifiers::by_table::batch_generations::batch_generation_entity::BatchGenerationEntity;
|
||||
// use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
// use crate::config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
// use tokens::tokens::media_files::MediaFileToken;
|
||||
//
|
||||
// use crate::queries::batch_generations::insert_batch_generation_records::{insert_batch_generation_records, InsertBatchArgs};
|
||||
|
||||
@@ -88,14 +88,15 @@ SET
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
// Template
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
use tokio;
|
||||
// Template
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
use tokio;
|
||||
|
||||
use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
use errors::AnyhowResult;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
#[ignore]
|
||||
use crate::config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
|
||||
#[ignore]
|
||||
#[tokio::test]
|
||||
async fn test_update_weights() -> AnyhowResult<()> {
|
||||
let db_connection_string = DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
|
||||
+10
-9
@@ -5,16 +5,17 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
use config::shared_constants::DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE;
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
use crate::config::shared_constants::DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct WeightsPage {
|
||||
pub weights: Vec<WeightJoinUser>,
|
||||
@@ -463,14 +464,14 @@ struct RawWeightJoinUser {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
|
||||
use crate::queries::model_weights::list::list_weights_query_builder::ListWeightsQueryBuilder;
|
||||
use crate::queries::model_weights::list::list_weights_query_builder::ListWeightsQueryBuilder;
|
||||
|
||||
#[test]
|
||||
#[test]
|
||||
fn predicates_without_scoping() {
|
||||
let query_builder = ListWeightsQueryBuilder::new();
|
||||
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
#[ignore]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use anyhow::Ok;
|
||||
use rand::Rng;
|
||||
use serial_test::serial;
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
use sqlx::MySqlPool;
|
||||
use tokio;
|
||||
use anyhow::Ok;
|
||||
use rand::Rng;
|
||||
use serial_test::serial;
|
||||
use sqlx::mysql::MySqlPoolOptions;
|
||||
use sqlx::MySqlPool;
|
||||
use tokio;
|
||||
|
||||
use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
// common tests
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::common::view_as::ViewAs;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::{model_weights::ModelWeightToken, users::UserToken};
|
||||
// common tests
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::common::view_as::ViewAs;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::{model_weights::ModelWeightToken, users::UserToken};
|
||||
|
||||
use crate::queries::model_weights::create::create_weight::create_weight;
|
||||
use crate::queries::model_weights::create::create_weight::CreateModelWeightsArgs;
|
||||
use crate::queries::model_weights::delete_weights::{
|
||||
delete_weights_as_mod,
|
||||
delete_weights_as_user,
|
||||
undelete_weights_as_mod,
|
||||
undelete_weights_as_user,
|
||||
};
|
||||
use crate::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use crate::queries::model_weights::list::list_weights_by_user::{list_weights_by_creator_username, ListWeightsForUserArgs};
|
||||
use crate::queries::model_weights::list::list_weights_query_builder::ListWeightsQueryBuilder;
|
||||
use crate::queries::users::user::get_user_token_by_username::get_user_token_by_username;
|
||||
use crate::config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
use crate::queries::model_weights::create::create_weight::create_weight;
|
||||
use crate::queries::model_weights::create::create_weight::CreateModelWeightsArgs;
|
||||
use crate::queries::model_weights::delete_weights::{
|
||||
delete_weights_as_mod,
|
||||
delete_weights_as_user,
|
||||
undelete_weights_as_mod,
|
||||
undelete_weights_as_user,
|
||||
};
|
||||
use crate::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use crate::queries::model_weights::list::list_weights_by_user::{list_weights_by_creator_username, ListWeightsForUserArgs};
|
||||
use crate::queries::model_weights::list::list_weights_query_builder::ListWeightsQueryBuilder;
|
||||
use crate::queries::users::user::get_user_token_by_username::get_user_token_by_username;
|
||||
|
||||
async fn setup() -> sqlx::Pool<sqlx::MySql> {
|
||||
async fn setup() -> sqlx::Pool<sqlx::MySql> {
|
||||
println!("Dropping database model_weights");
|
||||
|
||||
let db_connection_string = DEFAULT_MYSQL_CONNECTION_STRING;
|
||||
|
||||
+2
-1
@@ -6,10 +6,11 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
use config::shared_constants::DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::config::shared_constants::DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct TtsInferenceListPage {
|
||||
pub inference_records: Vec<TtsInferenceRecordForList>,
|
||||
|
||||
+4
-3
@@ -5,12 +5,13 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
use config::shared_constants::DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::users::UserToken;
|
||||
use tokens::tokens::zs_voices::ZsVoiceToken;
|
||||
|
||||
use crate::config::shared_constants::DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct ZsVoiceListPage {
|
||||
pub voices: Vec<ZsVoice>,
|
||||
@@ -301,9 +302,9 @@ struct RawInternalVoiceRecordForList {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::queries::voice_designer::voices::list_voices_query_builder::ListVoicesQueryBuilder;
|
||||
use crate::queries::voice_designer::voices::list_voices_query_builder::ListVoicesQueryBuilder;
|
||||
|
||||
#[test]
|
||||
#[test]
|
||||
fn predicates_without_scoping() {
|
||||
let query_builder = ListVoicesQueryBuilder::new();
|
||||
|
||||
|
||||
+2
-1
@@ -6,10 +6,11 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
use config::shared_constants::DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE;
|
||||
use enums::common::visibility::Visibility;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::config::shared_constants::DEFAULT_MYSQL_QUERY_RESULT_PAGE_SIZE;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct W2lInferenceListPage {
|
||||
pub inference_records: Vec<W2lInferenceRecordForList>,
|
||||
|
||||
Reference in new issue
Block a user