|
|
|
@ -124,15 +124,17 @@
|
|
|
|
|
(neo4j/exec-query! delete {:uuid uuid}))
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery create-link
|
|
|
|
|
"MATCH (i:instance {uuid:{instance_uuid}}),
|
|
|
|
|
(i2)
|
|
|
|
|
WHERE i2.uuid IN {instance_uuids}
|
|
|
|
|
CREATE (i)-[:link {name:{name},
|
|
|
|
|
created_at:{created_at}}]->(i2)")
|
|
|
|
|
|
|
|
|
|
(defn create-link! [instance-uuid name instance-uuids]
|
|
|
|
|
"MATCH (i:instance {uuid:{from}}),
|
|
|
|
|
(u:user {uuid:{by}}),
|
|
|
|
|
(t:instance)
|
|
|
|
|
WHERE t.uuid IN {to}
|
|
|
|
|
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
|
|
|
|
|
{:instance_uuid instance-uuid
|
|
|
|
|
:name name
|
|
|
|
|
:created_at (neo4j/now-str)
|
|
|
|
|
:instance_uuids instance-uuids}))
|
|
|
|
|
(assoc link
|
|
|
|
|
:uuid (neo4j/uuid)
|
|
|
|
|
:created_at (neo4j/now-str))))
|
|
|
|
|