|
|
@ -1,5 +1,5 @@
|
|
|
|
(ns wanijo.tag.routes
|
|
|
|
(ns wanijo.tag.routes
|
|
|
|
(:require [compojure.core :refer [defroutes POST]]
|
|
|
|
(:require [compojure.core :refer [defroutes POST DELETE]]
|
|
|
|
[ring.util.response :as resp]
|
|
|
|
[ring.util.response :as resp]
|
|
|
|
[formulare.core :as form]
|
|
|
|
[formulare.core :as form]
|
|
|
|
[wanijo.framework.routing :refer [register! path]]
|
|
|
|
[wanijo.framework.routing :refer [register! path]]
|
|
|
@ -16,7 +16,7 @@
|
|
|
|
user-uuid (-> req :session :uuid)]
|
|
|
|
user-uuid (-> req :session :uuid)]
|
|
|
|
(if (form/valid? forms/new-tag req)
|
|
|
|
(if (form/valid? forms/new-tag req)
|
|
|
|
(do
|
|
|
|
(do
|
|
|
|
(domain/merge-tags new-names
|
|
|
|
(domain/merge-tags! new-names
|
|
|
|
instance-uuid
|
|
|
|
instance-uuid
|
|
|
|
user-uuid)
|
|
|
|
user-uuid)
|
|
|
|
(resp/redirect (path :instance-show
|
|
|
|
(resp/redirect (path :instance-show
|
|
|
@ -26,7 +26,14 @@
|
|
|
|
(domain-schema/accessible-schemas! user-uuid)
|
|
|
|
(domain-schema/accessible-schemas! user-uuid)
|
|
|
|
req))))
|
|
|
|
req))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn remove-tag! [uuid instance-uuid]
|
|
|
|
|
|
|
|
(domain/remove-tag! uuid instance-uuid)
|
|
|
|
|
|
|
|
(resp/redirect (path :instance-edit-form {:uuid instance-uuid})))
|
|
|
|
|
|
|
|
|
|
|
|
(defroutes routes
|
|
|
|
(defroutes routes
|
|
|
|
(POST (register! :tag-create "/tag/:instance-uuid")
|
|
|
|
(POST (register! :tag-create "/tag/:instance-uuid")
|
|
|
|
[instance-uuid :as req]
|
|
|
|
[instance-uuid :as req]
|
|
|
|
(create-tag! instance-uuid req)))
|
|
|
|
(create-tag! instance-uuid req))
|
|
|
|
|
|
|
|
(DELETE (register! :tag-remove "/tag/:uuid/:instance-uuid")
|
|
|
|
|
|
|
|
[uuid instance-uuid]
|
|
|
|
|
|
|
|
(remove-tag! uuid instance-uuid)))
|
|
|
|