light refactorings

neo4j-4
Josha von Gizycki 5 years ago
parent 00ef765485
commit f328e95f4e

@ -14,10 +14,10 @@
::specs/name]))
(spec/def ::properties
(spec/coll-of
(spec/keys :req-un [::neo4j/uuid
::specs/created_at
::specs/updated_at
::domain-attr/attribute])))
(spec/keys :req-un [::neo4j/uuid
::specs/created_at
::specs/updated_at
::domain-attr/attribute])))
(spec/def ::target ::instance)
(spec/def ::source ::instance)
(spec/def ::tags
@ -119,7 +119,7 @@
::specs/attribute_uuid]))
(spec/def ::prop-tuple
(spec/coll-of
(spec/tuple fn? ::prop-tuple-values)))
(spec/tuple fn? ::prop-tuple-values)))
(neo4j/defquery edit-instance
"MATCH (i:instance {uuid:{uuid}})
SET i.name = {name},
@ -180,18 +180,14 @@
(neo4j/exec-query! delete {:uuid uuid}))
(defn group-by-link-and-assoc-tags [uuid query direction]
(->> (neo4j/exec-query! query
{:uuid uuid})
(group-by
(fn [{:keys [link schema] :as row}]
{:link link
direction (direction row)
:schema schema}))
(->> (neo4j/exec-query! query {:uuid uuid})
(group-by #(hash-map :link (:link %)
:schema (:schema %)
direction (direction %)))
(map (fn [[link tags]]
(assoc link
:tags
(filter some?
(map :tag tags)))))
(let [tags (map :tag tags)]
(assoc link
:tags (filter some? tags)))))
(sort-by (juxt #(-> % :schema :name)
#(-> % direction :name)
#(-> % direction :created_at)))))

Loading…
Cancel
Save