|
|
|
@ -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]]
|
|
|
|
|
(let [tags (map :tag tags)]
|
|
|
|
|
(assoc link
|
|
|
|
|
:tags
|
|
|
|
|
(filter some?
|
|
|
|
|
(map :tag tags)))))
|
|
|
|
|
:tags (filter some? tags)))))
|
|
|
|
|
(sort-by (juxt #(-> % :schema :name)
|
|
|
|
|
#(-> % direction :name)
|
|
|
|
|
#(-> % direction :created_at)))))
|
|
|
|
|