new routing method, returning the path

integration-tests
Josha von Gizycki 6 years ago
parent bf38eddb4a
commit 37c42d94ac

@ -8,6 +8,11 @@
(swap! all-routes (swap! all-routes
assoc id path)) assoc id path))
(defn register! [id path]
(swap! all-routes
assoc id path)
path)
(defn check-params [id path params] (defn check-params [id path params]
(when (nil? path) (when (nil? path)
(throw (throw

@ -3,7 +3,7 @@
[ring.util.response :as resp] [ring.util.response :as resp]
[wanijo.framework.view :as view] [wanijo.framework.view :as view]
[wanijo.framework.form :as form] [wanijo.framework.form :as form]
[wanijo.framework.routing :refer [register]] [wanijo.framework.routing :refer [register!]]
[wanijo.schema.domain :as domain] [wanijo.schema.domain :as domain]
[wanijo.schema.view :as view-schema] [wanijo.schema.view :as view-schema]
[wanijo.attribute.domain :as attr-domain])) [wanijo.attribute.domain :as attr-domain]))
@ -30,13 +30,16 @@
(resp/redirect "/schema")) (resp/redirect "/schema"))
{:status 403})) {:status 403}))
(register :schema-overview "/schema")
(register :schema-show "/schema/:uuid")
(register :schema-new "/schema/new")
(register :schema-delete "/schema/:uuid")
(defroutes routes (defroutes routes
(GET "/schema" [] view-schema/overview!) (GET (register! :schema-overview "/schema")
(GET "/schema/:uuid" [uuid :as req] (show-schema! uuid req)) []
(POST "/schema/new" [] new!) view-schema/overview!)
(DELETE "/schema/:uuid" [uuid :as req] (delete-schema! uuid (:session req)))) (GET (register! :schema-show "/schema/:uuid")
[uuid :as req]
(show-schema! uuid req))
(POST (register! :schema-new "/schema/new")
[]
new!)
(DELETE (register! :schema-delete "/schema/:uuid")
[uuid :as req]
(delete-schema! uuid (:session req))))

Loading…
Cancel
Save