mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-13 21:32:18 +00:00
model_weights delete need tests
This commit is contained in:
1 parent
f63eb94ed7
commit
ce3aa6be74
2 files changed
+29
-32
No files matched your search
@@ -6,8 +6,9 @@ pub async fn delete_weights_as_user(
|
||||
weight_token: &str,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<()> {
|
||||
let _r = sqlx::query!(
|
||||
r#"
|
||||
let _r = sqlx
|
||||
::query!(
|
||||
r#"
|
||||
UPDATE model_weights
|
||||
SET
|
||||
user_deleted_at = CURRENT_TIMESTAMP
|
||||
@@ -15,30 +16,26 @@ WHERE
|
||||
token = ?
|
||||
LIMIT 1
|
||||
"#,
|
||||
weight_token,
|
||||
)
|
||||
.execute(mysql_pool)
|
||||
.await?;
|
||||
weight_token
|
||||
)
|
||||
.execute(mysql_pool).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn delete_voice_as_mod(
|
||||
weight_token: &str,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<()> {
|
||||
let _r = sqlx::query!(
|
||||
r#"
|
||||
pub async fn delete_voice_as_mod(weight_token: &str, mysql_pool: &MySqlPool) -> AnyhowResult<()> {
|
||||
let _r = sqlx
|
||||
::query!(
|
||||
r#"
|
||||
UPDATE model_weights
|
||||
SET
|
||||
mod_deleted_at = CURRENT_TIMESTAMP,
|
||||
mod_deleted_at = CURRENT_TIMESTAMP
|
||||
WHERE
|
||||
token = ?
|
||||
LIMIT 1
|
||||
"#,
|
||||
weight_token,
|
||||
)
|
||||
.execute(mysql_pool)
|
||||
.await?;
|
||||
weight_token
|
||||
)
|
||||
.execute(mysql_pool).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -46,8 +43,9 @@ pub async fn undelete_weights_as_user(
|
||||
weight_token: &str,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<()> {
|
||||
let _r = sqlx::query!(
|
||||
r#"
|
||||
let _r = sqlx
|
||||
::query!(
|
||||
r#"
|
||||
UPDATE model_weights
|
||||
SET
|
||||
user_deleted_at = NULL
|
||||
@@ -55,10 +53,9 @@ WHERE
|
||||
token = ?
|
||||
LIMIT 1
|
||||
"#,
|
||||
weight_token,
|
||||
)
|
||||
.execute(mysql_pool)
|
||||
.await?;
|
||||
weight_token
|
||||
)
|
||||
.execute(mysql_pool).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -66,18 +63,18 @@ pub async fn undelete_weights_as_mod(
|
||||
weight_token: &str,
|
||||
mysql_pool: &MySqlPool
|
||||
) -> AnyhowResult<()> {
|
||||
let _r = sqlx::query!(
|
||||
r#"
|
||||
let _r = sqlx
|
||||
::query!(
|
||||
r#"
|
||||
UPDATE model_weights
|
||||
SET
|
||||
mod_deleted_at = NULL,
|
||||
mod_deleted_at = NULL
|
||||
WHERE
|
||||
token = ?
|
||||
LIMIT 1
|
||||
"#,
|
||||
weight_token,
|
||||
)
|
||||
.execute(mysql_pool)
|
||||
.await?;
|
||||
weight_token
|
||||
)
|
||||
.execute(mysql_pool).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
pub mod create_weight;
|
||||
//pub mod delete_weight;
|
||||
pub mod delete_weights;
|
||||
pub mod get_weight;
|
||||
pub mod update_weight;
|
||||
Reference in new issue
Block a user