some refactoring

integration-tests
Josha von Gizycki 5 years ago
parent 30171664a8
commit 45b15372d4

@ -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 instance->prop-tuples [instance]
(map (fn [prop]
(let [prop-uuid (:uuid prop)
uuid (if (empty? prop-uuid)
(neo4j/uuid)
prop-uuid)]
[edit-property
{:uuid uuid
:now (neo4j/now-str)
:value (:value prop)
:instance_uuid (:uuid instance)
:attribute_uuid (-> prop :attribute :uuid)}]))
(:properties instance)))
(defn edit! [instance] (defn edit! [instance]
(let [prop-tuples (map #(vector edit-property (let [prop-tuples (instance->prop-tuples instance)]
{:uuid (if (empty? (:uuid %))
(neo4j/uuid)
(:uuid %))
:now (neo4j/now-str)
:value (:value %)
:instance_uuid (:uuid instance)
:attribute_uuid (-> % :attribute :uuid)})
(:properties instance))]
(apply neo4j/exec-queries! (apply neo4j/exec-queries!
(concat [[edit-instance (concat [[edit-instance
{:uuid (:uuid instance) {:uuid (:uuid instance)

@ -92,7 +92,7 @@
(when (seq (:tags instance)) (when (seq (:tags instance))
[:section.tags [:section.tags
[:ul [:ul
(for [tag (:tags instace)] (for [tag (:tags instance)]
[:li (:name tag)])]]) [:li (:name tag)])]])
(when (seq (:properties instance)) (when (seq (:properties instance))
[:section.properties [:section.properties

Loading…
Cancel
Save