 
 (defn post-signup [req]
   (let [{:keys [username password]} (:params req)]
-    (if (> (count (get-user-by-username username)) 0)
+    (if (> (count (get-user-by-username db username)) 0)
       (assoc-in (redirect "/signup")
                 [:session :_flash]
                 "That username is taken.")
-      (let [user (create-user! username (creds/hash-bcrypt password))]
+      (let [user (create-user! db username (creds/hash-bcrypt password))]
         (friend/merge-authentication (redirect "/") (user-map user))))))
 
 (defn get-posts [req]
-  (let [posts (all-posts)
+  (let [posts (all-posts db)
         identity (friend/identity req)]
     (wrap-view req views/post-list {:posts posts})))
 


(defn get-post [req]
  (let [post-id (Integer/parseInt (:id (:params req)))
        post (first (get-post-by-id post-id))
        identity (friend/identity req)]
    (wrap-view req views/post-page {:post post})))


(defn post-post [req]
  (let [params (:params req)
        identity (friend/identity req)
        user (first (get-user-by-username db (:current identity)))
        post (create-post! db
                           (:title params)
                           (if (empty? (:url params))
                             nil
                             (:url params))
