Added functionality to delete variant.

This commit is contained in:
2026-01-24 03:02:52 +01:00
parent cec9e3754f
commit a06ec2f980
4 changed files with 68 additions and 3 deletions
+20
View File
@@ -123,3 +123,23 @@ pub async fn update_variant(variant_id: i64, variant: &Variant, pool: PgPool) ->
}
}
}
pub async fn delete_variant(variant_id: i64, pool: PgPool) -> Option<()> {
let result = sqlx::query(
format!("DELETE FROM {} WHERE id = {}",
"variant",
variant_id
).as_str()
).execute(&pool).await;
match result {
Ok(_) => {
Some(())
}
Err(err) => {
println!("Error deleting variant: {:#?}", err);
None
}
}
}