|
|
@ -1,5 +1,6 @@
|
|
|
|
(ns wanijo.schema.middleware
|
|
|
|
(ns wanijo.schema.middleware
|
|
|
|
(:require [wanijo.schema.domain :as domain]))
|
|
|
|
(:require [wanijo.schema.domain :as domain]
|
|
|
|
|
|
|
|
[wanijo.framework.common :refer [in?]]))
|
|
|
|
|
|
|
|
|
|
|
|
(defn wrap-user-schemas [handler]
|
|
|
|
(defn wrap-user-schemas [handler]
|
|
|
|
(fn [req]
|
|
|
|
(fn [req]
|
|
|
@ -7,8 +8,7 @@
|
|
|
|
(let [created (domain/all-created-by! uuid)
|
|
|
|
(let [created (domain/all-created-by! uuid)
|
|
|
|
created-uids (map :uuid created)
|
|
|
|
created-uids (map :uuid created)
|
|
|
|
others (filter (fn [other]
|
|
|
|
others (filter (fn [other]
|
|
|
|
(not (some (partial = (:uuid other))
|
|
|
|
(not (in? created-uids (:uuid other))))
|
|
|
|
created-uids)))
|
|
|
|
|
|
|
|
(domain/all!))]
|
|
|
|
(domain/all!))]
|
|
|
|
(handler (-> req
|
|
|
|
(handler (-> req
|
|
|
|
(assoc-in [:session :created-schemas] created)
|
|
|
|
(assoc-in [:session :created-schemas] created)
|
|
|
|