change links from simple relationships to nodes

integration-tests
Josha von Gizycki 6 years ago
parent 06b049f0ff
commit 962ff1310a

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

@ -88,9 +88,10 @@
(let [form (link-form! schema-uuid)] (let [form (link-form! schema-uuid)]
(if (form/valid? form req) (if (form/valid? form req)
(let [form-data (form/form-data form req)] (let [form-data (form/form-data form req)]
(domain/create-link! uuid (domain/create-link! {:from uuid
(:name form-data) :name (:name form-data)
(:instances form-data)) :to (:instances form-data)
:by (get-in req [:session :uuid])})
(resp/redirect (path :instance-show {:uuid uuid}))) (resp/redirect (path :instance-show {:uuid uuid})))
(link-selection! uuid schema-uuid req)))) (link-selection! uuid schema-uuid req))))

Loading…
Cancel
Save