diff --git a/api/src/background_worker/worker.rs b/api/src/background_worker/worker.rs index a021e74..32cad80 100644 --- a/api/src/background_worker/worker.rs +++ b/api/src/background_worker/worker.rs @@ -86,8 +86,7 @@ where }, }; - let Some(model) = model - else { + let Some(model) = model else { error!("Job tracking not found"); return; }; diff --git a/api/src/mutations/mint.rs b/api/src/mutations/mint.rs index 733373b..7af2012 100644 --- a/api/src/mutations/mint.rs +++ b/api/src/mutations/mint.rs @@ -885,13 +885,16 @@ impl Mutation { .all(conn) .await?; - let tx = conn.begin().await?; - - let mut collection_am: collections::ActiveModel = collection_model.clone().into(); + let tx: sea_orm::DatabaseTransaction = conn.begin().await?; - collection_am.supply = Set(collection_model.supply.map(|supply| supply.add(1))); - - collection_am.update(&tx).await?; + collections::Entity::update_many() + .col_expr( + collections::Column::Supply, + Expr::value(Expr::col(collections::Column::Supply).add(Value::Int(Some(1)))), + ) + .filter(collections::Column::Id.eq(collection_model.id)) + .exec(&tx) + .await?; let mint = collection_mints::ActiveModel { collection_id: Set(drop.collection_id),