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
assoc id path))
(defn register! [id path]
(swap! all-routes
assoc id path)
path)
(defn check-params [id path params]
(when (nil? path)
(throw

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