From bcaa65e799d6baf857e33c73947b9bdc993313ee Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Sat, 22 Jun 2019 14:31:50 +0200 Subject: [PATCH] fix error when editing multiple properties, preparations for tags --- src/wanijo/instance/domain.clj | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/wanijo/instance/domain.clj b/src/wanijo/instance/domain.clj index 38a4ee5..5496911 100644 --- a/src/wanijo/instance/domain.clj +++ b/src/wanijo/instance/domain.clj @@ -103,7 +103,9 @@ (defn edit! [instance] (let [prop-tuples (map #(vector edit-property - {:uuid (:uuid % (neo4j/uuid)) + {:uuid (if (empty? (:uuid %)) + (neo4j/uuid) + (:uuid %)) :now (neo4j/now-str) :value (:value %) :instance_uuid (:uuid instance) @@ -190,6 +192,15 @@ (neo4j/exec-query! delete-link {:uuid uuid})) +(neo4j/defquery tags + "MATCH (i:instance {uuid:{uuid}})-[:has]->(t:tag) + RETURN t + ORDER BY t.name") + +(defn tags! [uuid] + (neo4j/exec-query! tags + {:uuid uuid})) + (defn full-instance-by-uuid! [uuid] (assoc (find-by-uuid! uuid) :properties @@ -197,7 +208,9 @@ :links-out (outgoing-links! uuid) :links-in - (incoming-links! uuid))) + (incoming-links! uuid) + :tags + (tags! uuid))) (neo4j/defquery is-starred "MATCH (u:user {uuid:{user_uuid}}),