aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/post.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/post.rs')
-rw-r--r--src/models/post.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/models/post.rs b/src/models/post.rs
index 922dbca..3dd0879 100644
--- a/src/models/post.rs
+++ b/src/models/post.rs
@@ -53,4 +53,11 @@ impl Post {
.execute(&*conn)
.expect("Error saving post.");
}
+
+ pub fn delete(post_id: i32, conn: utils::DbConn) {
+ use ::schema::posts::dsl::*;
+ diesel::delete(posts.filter(id.eq(post_id)))
+ .execute(&*conn)
+ .expect(&format!("Could not delete post with id {}", post_id));
+ }
}