   [:as {{:keys [name description public_perms] :as body} :body}]
   {name         [Required NonEmptyString]
    public_perms [Required PublicPerms]}
-  (->> (ins Dashboard
-            :name name
-            :description description
-            :public_perms public_perms
-            :creator_id *current-user-id*)
+  (->> (db/ins Dashboard
+               :name name
+               :description description
+               :public_perms public_perms
+               :creator_id *current-user-id*)
        (events/publish-event :dashboard-create)))
 
 (defendpoint GET "/:id"

  [id :as {{:keys [cardId]} :body}]
  {cardId [Required Integer]}
  (write-check Dashboard id)
  (check-400 (exists? Card :id cardId))
  (let [result (ins DashboardCard :card_id cardId, :dashboard_id id)]
    (events/publish-event :dashboard-add-cards {:id id :actor_id *current-user-id* :dashcards [result]})
    result))


              :col} ...]}"
  [id :as {{:keys [cards]} :body}]
  (write-check Dashboard id)
  (let [dashcard-ids (set (db/sel :many :field [DashboardCard :id] :dashboard_id id))]
    (doseq [{dashcard-id :id :keys [sizeX sizeY row col]} cards]
      ;; ensure the dashcard we are updating is part of the given dashboard
      (when (contains? dashcard-ids dashcard-id)
        (db/upd DashboardCard dashcard-id :sizeX sizeX :sizeY sizeY :row row :col col))))
  (events/publish-event :dashboard-reposition-cards {:id id :actor_id *current-user-id* :dashcards cards})
  {:status :ok})

