summaryrefslogtreecommitdiff
path: root/src/db/story.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/story.rs')
-rw-r--r--src/db/story.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/db/story.rs b/src/db/story.rs
index 137c964..9e5fdb9 100644
--- a/src/db/story.rs
+++ b/src/db/story.rs
@@ -99,6 +99,19 @@ impl ProductDatabaseHandler for Story {
Ok(story)
}
+
+ async fn delete(pool: &SqlitePool, pid: i64) -> Result<(), AppError>
+ where
+ Self: Sized,
+ {
+ let mut tx = pool.begin().await?;
+ sqlx::query!("DELETE FROM story WHERE pid = $1", pid)
+ .execute(&mut *tx)
+ .await?;
+ Product::delete(&mut tx, pid).await?;
+ tx.commit().await?;
+ Ok(())
+ }
}
impl PageBuilder for Story {