|
|
|
@ -103,13 +103,28 @@
|
|
|
|
|
(domain/delete-link! link-uuid)
|
|
|
|
|
(resp/redirect (path :instance-edit-form {:uuid uuid})))
|
|
|
|
|
|
|
|
|
|
(defn mark-starred! [uuid req]
|
|
|
|
|
(domain/mark-starred! uuid
|
|
|
|
|
(-> req :session :uuid))
|
|
|
|
|
(resp/redirect (path :instance-show {:uuid uuid})))
|
|
|
|
|
|
|
|
|
|
(defn remove-starred! [uuid req]
|
|
|
|
|
(domain/remove-starred! uuid
|
|
|
|
|
(-> req :session :uuid))
|
|
|
|
|
(resp/redirect (path :instance-show {:uuid uuid})))
|
|
|
|
|
|
|
|
|
|
(defn list-starred! [req]
|
|
|
|
|
(view/list-starred
|
|
|
|
|
(domain/starred-by-user! (-> req :session :uuid))
|
|
|
|
|
req))
|
|
|
|
|
|
|
|
|
|
(defroutes routes
|
|
|
|
|
(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)))
|
|
|
|
|
(middleware-schema/wrap-allowed-to-read
|
|
|
|
|
#(get-in % [:params :schema-uuid])))
|
|
|
|
|
(POST (register! :instance-new "/instance/new") []
|
|
|
|
|
new!)
|
|
|
|
|
(GET (register! :instance-show "/instance/:uuid")
|
|
|
|
@ -135,4 +150,15 @@
|
|
|
|
|
(DELETE (register! :instance-link-delete
|
|
|
|
|
"/instance/:uuid/link/:link-uuid")
|
|
|
|
|
[uuid link-uuid :as req]
|
|
|
|
|
(delete-link! uuid link-uuid req)))
|
|
|
|
|
(delete-link! uuid link-uuid req))
|
|
|
|
|
(POST (register! :instance-mark-starred
|
|
|
|
|
"/instance/:uuid/starred")
|
|
|
|
|
[uuid :as req]
|
|
|
|
|
(mark-starred! uuid req))
|
|
|
|
|
(DELETE (register! :instance-remove-starred
|
|
|
|
|
"/instance/:uuid/starred")
|
|
|
|
|
[uuid :as req]
|
|
|
|
|
(remove-starred! uuid req))
|
|
|
|
|
(GET (register! :instance-list-starred "/instance/starred/list")
|
|
|
|
|
[:as req]
|
|
|
|
|
(list-starred! req)))
|
|
|
|
|