|
|
|
@ -63,12 +63,19 @@
|
|
|
|
|
(resp/redirect (path :instance-show instance)))
|
|
|
|
|
(show! uuid req))))
|
|
|
|
|
|
|
|
|
|
(defn delete! [uuid req]
|
|
|
|
|
(let [schema (domain-schema/find-by-instance! uuid)]
|
|
|
|
|
(domain/delete! uuid)
|
|
|
|
|
(resp/redirect (path :instance-list
|
|
|
|
|
{:schema-uuid (:uuid schema)}))))
|
|
|
|
|
|
|
|
|
|
(defroutes routes
|
|
|
|
|
(wrap-routes (GET (register! :instance-list "/instance/list/:schema-uuid")
|
|
|
|
|
[schema-uuid :as req]
|
|
|
|
|
(list! schema-uuid req))
|
|
|
|
|
(middleware-schema/wrap-allowed-to-read
|
|
|
|
|
#(get-in % [:params :schema-uuid])))
|
|
|
|
|
(wrap-routes
|
|
|
|
|
(GET (register! :instance-list "/instance/list/:schema-uuid")
|
|
|
|
|
[schema-uuid :as req]
|
|
|
|
|
(list! schema-uuid req))
|
|
|
|
|
(let [schema-fn #(get-in % [:params :schema-uuid])]
|
|
|
|
|
(middleware-schema/wrap-allowed-to-read schema-fn)))
|
|
|
|
|
(POST (register! :instance-new "/instance/new") []
|
|
|
|
|
new!)
|
|
|
|
|
(GET (register! :instance-show "/instance/:uuid")
|
|
|
|
@ -76,4 +83,7 @@
|
|
|
|
|
(show! uuid req))
|
|
|
|
|
(POST (register! :instance-edit "/instance/:uuid")
|
|
|
|
|
[uuid :as req]
|
|
|
|
|
(edit! uuid req)))
|
|
|
|
|
(edit! uuid req))
|
|
|
|
|
(DELETE (register! :instance-delete "/instance/:uuid")
|
|
|
|
|
[uuid :as req]
|
|
|
|
|
(delete! uuid req)))
|
|
|
|
|