|
|
|
@ -2,9 +2,26 @@
|
|
|
|
|
(:require [compojure.core :refer [defroutes GET POST]]
|
|
|
|
|
[ring.util.response :as resp]
|
|
|
|
|
[wanijo.framework.form :as form]
|
|
|
|
|
[wanijo.framework.routing :refer [register]]))
|
|
|
|
|
[wanijo.framework.routing :refer [register path]]
|
|
|
|
|
[wanijo.attribute.domain :as domain]
|
|
|
|
|
[wanijo.schema.view :as view-schema]
|
|
|
|
|
[wanijo.schema.domain :as domain-schema]))
|
|
|
|
|
|
|
|
|
|
(defn new! [req])
|
|
|
|
|
(defn new! [req]
|
|
|
|
|
(let [schema-uuid (get-in req [:params :schema])]
|
|
|
|
|
(if (form/valid? view-schema/new-attr-form req)
|
|
|
|
|
(do
|
|
|
|
|
(domain/create-new!
|
|
|
|
|
(get-in req [:params :name])
|
|
|
|
|
(get-in req [:params :type])
|
|
|
|
|
schema-uuid
|
|
|
|
|
(get-in req [:session :uuid]))
|
|
|
|
|
(resp/redirect (path :schema-show
|
|
|
|
|
schema-uuid)))
|
|
|
|
|
(view-schema/show-schema!
|
|
|
|
|
(domain-schema/find-by-uuid! schema-uuid)
|
|
|
|
|
(domain/find-by-schema! schema-uuid)
|
|
|
|
|
req))))
|
|
|
|
|
|
|
|
|
|
(register :attribute-new "/attribute/new")
|
|
|
|
|
|
|
|
|
|