   [id :as {{:keys [description name public_perms]} :body}]
   {name NonEmptyString, public_perms PublicPerms}
   (write-check Dashboard id)
-  (check-500 (upd-non-nil-keys Dashboard id
-                               :description description
-                               :name name))
-  (events/publish-event :dashboard-update (assoc (sel :one Dashboard :id id) :actor_id *current-user-id*)))
+  (check-500 (db/upd-non-nil-keys Dashboard id
+                                  :description description
+                                  :name name))
+  (events/publish-event :dashboard-update (assoc (db/sel :one Dashboard :id id) :actor_id *current-user-id*)))
 
 (defendpoint DELETE "/:id"
   "Delete a `Dashboard`."
   [id]
   (write-check Dashboard id)
   ;; TODO - it would be much more natural if `cascade-delete` returned the deleted entity instead of an api response
-  (let [dashboard (sel :one Dashboard :id id)
-        result (cascade-delete Dashboard :id id)]
+  (let [dashboard (db/sel :one Dashboard :id id)
+        result    (db/cascade-delete Dashboard :id id)]
     (events/publish-event :dashboard-delete (assoc dashboard :actor_id *current-user-id*))
     result))
 

  [f]
  {f FilterOptionAllOrMine}
  (-> (case (or f :all)
        :all  (sel :many Dashboard (k/where (or {:creator_id *current-user-id*}
                                                {:public_perms [> common/perms-none]})))
        :mine (sel :many Dashboard :creator_id *current-user-id*))
      (hydrate :creator :can_read :can_write)))

(defendpoint POST "/"

  {dashcardId [Required String->Integer]}
  (write-check Dashboard id)
  ;; TODO - it would be nicer to do this if `del` returned the object that was deleted instead of an api response
  (let [dashcard (db/sel :one DashboardCard :id dashcardId)
        result   (db/del DashboardCard :id dashcardId :dashboard_id id)]
    (events/publish-event :dashboard-remove-cards {:id id :actor_id *current-user-id* :dashcards [dashcard]})
    result))

