 
 (defn create-user!
   "creates a user, returns id"
-  [attrs]
-  (-> {:user/id (attrs :id)
-       :user/email (attrs :email)
-       :user/avatar (attrs :avatar)
-       :user/password-token (password/encrypt (attrs :password))}
+  [{:keys [id email avatar password]}]
+  (-> {:user/id id
+       :user/email email
+       :user/avatar avatar
+       :user/password-token (password/encrypt password)}
       create-entity!
       db->user))
 

      ]))


(defn uuid []
  (d/squuid))

(defn- db->user [e]
  {:id (:user/id e)
   :email (:user/email e)
   :avatar (:user/avatar e)})

(defn- db->message [e]
  {:id (:message/id e)
   :content (:message/content e)
   :user-id (:user/id (:message/user e))

       (d/db *conn*)
       user-id))

(defn- db->thread
  [thread]
  {:id (thread :thread/id)
   :messages (map (fn [msg]
                    {:id (msg :message/id)
