parent
cc30b94d24
commit
b1d7c31a83
@ -0,0 +1,20 @@
|
|||||||
|
(ns wanijo.schema.domain
|
||||||
|
(:require [clojure.spec.alpha :as spec]
|
||||||
|
[wanijo.specs :as specs]
|
||||||
|
[wanijo.infrastructure.neo4j :as neo4j]))
|
||||||
|
|
||||||
|
(spec/def ::name
|
||||||
|
(spec/and ::specs/name (complement empty?)))
|
||||||
|
(spec/def ::assigned-to
|
||||||
|
(spec/or :public empty?
|
||||||
|
:assigned (spec/coll-of ::neo4j/uuid)
|
||||||
|
:assigned-single ::neo4j/uuid))
|
||||||
|
(spec/def ::schema
|
||||||
|
(spec/keys ::req-un [::name
|
||||||
|
::specs/created-at
|
||||||
|
::neo4j/uuid]))
|
||||||
|
|
||||||
|
(defn has-user-permission?
|
||||||
|
[{public? :is_public
|
||||||
|
user-permission :user_has_permission}]
|
||||||
|
(or public? user-permission))
|
Loading…
Reference in new issue