summary refs log tree commit diff stats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index f6d136d..6c38431 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -21,17 +21,15 @@ fn main() {
     println!("a community notices system");
     println!();
 
-    let db = db::Conn::new();
-
     if *conf::DEBUG {
         log::info!("Startup completed in {:?}ms", start.elapsed().as_millis());
     }
 
     if arg_matches.subcommand_matches("post").is_some() {
         log::info!("New post...");
-        error::helper(posts::create(&db), "Error creating new post");
+        error::helper(posts::create(), "Error creating new post");
     } else if let Some(updmatch) = arg_matches.subcommand_matches("update") {
-        let id: u32 = if let Some(val) = updmatch.value_of("id") {
+        let id: usize = if let Some(val) = updmatch.value_of("id") {
             error::helper(val.parse(), "Couldn't parse ID")
         } else {
             0
@@ -40,11 +38,11 @@ fn main() {
         log::info!("Updating post ...");
 
         error::helper(
-            posts::update_handler(&db, id),
+            posts::update_handler(id),
             format!("Error updating post {}", id).as_ref(),
         );
     } else if let Some(delmatch) = arg_matches.subcommand_matches("delete") {
-        let id: u32 = if let Some(val) = delmatch.value_of("id") {
+        let id: usize = if let Some(val) = delmatch.value_of("id") {
             error::helper(val.parse(), "Couldn't parse ID")
         } else {
             0
@@ -53,10 +51,10 @@ fn main() {
         log::info!("Deleting post");
 
         error::helper(
-            posts::delete_handler(&db, id),
+            posts::delete_handler(id),
             format!("Error deleting post {}", id).as_ref(),
         );
     }
 
-    error::helper(posts::display(&db), "Error displaying posts");
+    error::helper(posts::display(), "Error displaying posts");
 }