|
|
@ -130,17 +130,23 @@
|
|
|
|
"MATCH (i:instance {uuid:{from}}),
|
|
|
|
"MATCH (i:instance {uuid:{from}}),
|
|
|
|
(u:user {uuid:{by}}),
|
|
|
|
(u:user {uuid:{by}}),
|
|
|
|
(t:instance)
|
|
|
|
(t:instance)
|
|
|
|
WHERE t.uuid IN {to}
|
|
|
|
WHERE t.uuid = {target}
|
|
|
|
CREATE (l:link {uuid:{uuid}})-[:created_by]->(u)
|
|
|
|
CREATE (l:link {uuid:{uuid}})-[:created_by]->(u)
|
|
|
|
SET l.created_at = {created_at},
|
|
|
|
SET l.created_at = {created_at},
|
|
|
|
l.name = {name}
|
|
|
|
l.name = {name}
|
|
|
|
CREATE (i)<-[:link_from]-(l)-[:link_to]->(t)")
|
|
|
|
CREATE (i)<-[:link_from]-(l)-[:link_to]->(t)")
|
|
|
|
|
|
|
|
|
|
|
|
(defn create-link! [link]
|
|
|
|
(defn create-link! [link]
|
|
|
|
(neo4j/exec-query! create-link
|
|
|
|
(let [tuples (map (fn [target-uuid]
|
|
|
|
(assoc link
|
|
|
|
[create-link
|
|
|
|
|
|
|
|
{:from (:from link)
|
|
|
|
|
|
|
|
:by (:by link)
|
|
|
|
|
|
|
|
:target target-uuid
|
|
|
|
:uuid (neo4j/uuid)
|
|
|
|
:uuid (neo4j/uuid)
|
|
|
|
:created_at (neo4j/now-str))))
|
|
|
|
:created_at (neo4j/now-str)
|
|
|
|
|
|
|
|
:name (:name link)}])
|
|
|
|
|
|
|
|
(:to link))]
|
|
|
|
|
|
|
|
(apply neo4j/exec-queries! tuples)))
|
|
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery outgoing-links
|
|
|
|
(neo4j/defquery outgoing-links
|
|
|
|
"MATCH (i:instance {uuid:{uuid}}),
|
|
|
|
"MATCH (i:instance {uuid:{uuid}}),
|
|
|
|