|
|
@ -101,16 +101,22 @@
|
|
|
|
ON MATCH SET p.updated_at = {now},
|
|
|
|
ON MATCH SET p.updated_at = {now},
|
|
|
|
p.value = {value}")
|
|
|
|
p.value = {value}")
|
|
|
|
|
|
|
|
|
|
|
|
(defn edit! [instance]
|
|
|
|
(defn instance->prop-tuples [instance]
|
|
|
|
(let [prop-tuples (map #(vector edit-property
|
|
|
|
(map (fn [prop]
|
|
|
|
{:uuid (if (empty? (:uuid %))
|
|
|
|
(let [prop-uuid (:uuid prop)
|
|
|
|
|
|
|
|
uuid (if (empty? prop-uuid)
|
|
|
|
(neo4j/uuid)
|
|
|
|
(neo4j/uuid)
|
|
|
|
(:uuid %))
|
|
|
|
prop-uuid)]
|
|
|
|
|
|
|
|
[edit-property
|
|
|
|
|
|
|
|
{:uuid uuid
|
|
|
|
:now (neo4j/now-str)
|
|
|
|
:now (neo4j/now-str)
|
|
|
|
:value (:value %)
|
|
|
|
:value (:value prop)
|
|
|
|
:instance_uuid (:uuid instance)
|
|
|
|
:instance_uuid (:uuid instance)
|
|
|
|
:attribute_uuid (-> % :attribute :uuid)})
|
|
|
|
:attribute_uuid (-> prop :attribute :uuid)}]))
|
|
|
|
(:properties instance))]
|
|
|
|
(:properties instance)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn edit! [instance]
|
|
|
|
|
|
|
|
(let [prop-tuples (instance->prop-tuples instance)]
|
|
|
|
(apply neo4j/exec-queries!
|
|
|
|
(apply neo4j/exec-queries!
|
|
|
|
(concat [[edit-instance
|
|
|
|
(concat [[edit-instance
|
|
|
|
{:uuid (:uuid instance)
|
|
|
|
{:uuid (:uuid instance)
|
|
|
|