   component/Lifecycle
   (start [this]
     (mqttapi/subscribe mqtt "/store/form" mqtt->form-submit)
-    (assoc this :routes (routes)))
+    (assoc this :routes (routes mqtt)))
   (stop [this]
     this))
 

        device-identifier (:client (:metadata form-data))]
    (formmodel/add-form-data form-data form-id device-identifier)))

(defn- routes []
  #{["/api/forms"                :get    (conj common-interceptors `http-get-all-forms)]
    ["/api/forms"                :post   (conj common-interceptors check-auth `http-create-form)]
    ["/api/forms/:form-key"      :delete (conj common-interceptors check-auth `http-delete-form-by-key)]
    ["/api/forms/:form-key"      :get    (conj common-interceptors check-auth `http-get-form-by-form-key)]
    ;; todo: need to figure out why forms causes a route conflict
    ["/api/form/:form-id/submit"   :post   (conj common-interceptors check-auth `http-submit-form-data) :constraints {:form-id #"[0-9]+"}]


(defn http-delete-form-by-key
  "Deletes all forms matching the form-key"
  [mqtt request]
  (let [form-key (URLDecoder/decode (get-in request [:path-params :form-key]))
        forms    (formmodel/find-by-form-key form-key)]
    (doall (map delete-form-by-id forms))
    (mqttapi/publish-scmessage mqtt "/config/update" (scm/map->SCMessage {:action (.value SCCommand/CONFIG_REMOVE_FORM)}))
    (response/ok (str "Deleted form " form-key))))

(defn http-submit-form-data
