diff --git a/src/wanijo/attribute/routes.clj b/src/wanijo/attribute/routes.clj index 759b310..23d1d3c 100644 --- a/src/wanijo/attribute/routes.clj +++ b/src/wanijo/attribute/routes.clj @@ -2,7 +2,7 @@ (:require [compojure.core :refer [defroutes GET POST]] [ring.util.response :as resp] [wanijo.framework.form :as form] - [wanijo.framework.routing :refer [register path]] + [wanijo.framework.routing :refer [register! path]] [wanijo.attribute.domain :as domain] [wanijo.schema.view :as view-schema] [wanijo.schema.domain :as domain-schema])) @@ -22,7 +22,7 @@ (domain/find-by-schema! schema-uuid) req)))) -(register :attribute-new "/attribute/new") - (defroutes routes - (POST "/attribute/new" [] new!)) + (POST (register! :attribute-new "/attribute/new") + [] + new!)) diff --git a/src/wanijo/schema/routes.clj b/src/wanijo/schema/routes.clj index 2aee94b..3b53051 100644 --- a/src/wanijo/schema/routes.clj +++ b/src/wanijo/schema/routes.clj @@ -17,12 +17,6 @@ (resp/redirect "/schema")) (view-schema/overview! req))) -(defn show-schema! [uuid req] - (view-schema/show-schema! - (domain/find-by-uuid! uuid) - (attr-domain/find-by-schema! uuid) - req)) - (defn delete-schema! [uuid session] (if (domain/can-user-modify? uuid (:uuid session)) (do @@ -36,7 +30,10 @@ view-schema/overview!) (GET (register! :schema-show "/schema/:uuid") [uuid :as req] - (show-schema! uuid req)) + (view-schema/show-schema! + (domain/find-by-uuid! uuid) + (attr-domain/find-by-schema! uuid) + req)) (POST (register! :schema-new "/schema/new") [] new!) diff --git a/src/wanijo/user/routes.clj b/src/wanijo/user/routes.clj index b9b4cd9..9628916 100644 --- a/src/wanijo/user/routes.clj +++ b/src/wanijo/user/routes.clj @@ -1,16 +1,17 @@ (ns wanijo.user.routes (:require [compojure.core :refer [defroutes GET POST]] [ring.util.response :as resp] - [wanijo.framework.routing :refer [register]] + [wanijo.framework.routing :refer [register!]] [wanijo.user.view :as view-user] [wanijo.user.domain :as domain])) -(register :user-profile "/user/profile") -(register :user-edit "/user/edit") - -(defn profile! [req] - (view-user/profile! req - (domain/find! (get-in req [:session :ident])))) - (defroutes routes - (GET "/user/profile" [] profile!)) + (GET + (register! :user-profile "/user/profile") + [:as req] + (view-user/profile! + req + (domain/find! (get-in req [:session :ident])))) + (POST (register! :user-edit "/user/edit") + [] + (fn [req])))