fix links getting the same uuid in batch operations

integration-tests
Josha von Gizycki 6 years ago
parent 8416789f31
commit 0158d4c29a

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

Loading…
Cancel
Save