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}}),