light refactorings

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

@ -180,18 +180,14 @@
(neo4j/exec-query! delete {:uuid uuid})) (neo4j/exec-query! delete {:uuid uuid}))
(defn group-by-link-and-assoc-tags [uuid query direction] (defn group-by-link-and-assoc-tags [uuid query direction]
(->> (neo4j/exec-query! query (->> (neo4j/exec-query! query {:uuid uuid})
{:uuid uuid}) (group-by #(hash-map :link (:link %)
(group-by :schema (:schema %)
(fn [{:keys [link schema] :as row}] direction (direction %)))
{:link link
direction (direction row)
:schema schema}))
(map (fn [[link tags]] (map (fn [[link tags]]
(let [tags (map :tag tags)]
(assoc link (assoc link
:tags :tags (filter some? tags)))))
(filter some?
(map :tag tags)))))
(sort-by (juxt #(-> % :schema :name) (sort-by (juxt #(-> % :schema :name)
#(-> % direction :name) #(-> % direction :name)
#(-> % direction :created_at))))) #(-> % direction :created_at)))))

Loading…
Cancel
Save