parent
bac79cd60c
commit
59755dc041
@ -0,0 +1,19 @@
|
||||
(ns wanijo.tag.domain
|
||||
(:require [clojure.spec.alpha :as spec]
|
||||
[wanijo.specs :as specs]
|
||||
[wanijo.framework.neo4j :as neo4j]))
|
||||
|
||||
(spec/def ::name ::specs/req-name)
|
||||
(spec/def ::tag
|
||||
(spec/keys :req-un [::specs/uuid
|
||||
::specs/created_at
|
||||
::name]))
|
||||
|
||||
(neo4j/defquery tags-by-instance
|
||||
"MATCH (i:instance {uuid:{uuid}})-[:has]->(t:tag)
|
||||
RETURN t
|
||||
ORDER BY t.name")
|
||||
(defn tags-by-instance! [instance-uuid]
|
||||
{:post [(spec/assert (spec/coll-of ::tag) %)]}
|
||||
(neo4j/exec-query! tags-by-instance
|
||||
{:uuid instance-uuid}))
|
Loading…
Reference in new issue