This commit is contained in:
Bryce Covert
2020-01-05 10:33:58 -08:00
7 changed files with 147 additions and 39 deletions

View File

@@ -52,4 +52,18 @@
id))
(->graphql))))
(defn merge-vendors [context {:keys [from to]} value]
(let [conn (d/connect uri)
transaction (->> (d/query {:query {:find '[?x ?a2]
:in '[$ ?vendor-from ]
:where ['[?x ?a ?vendor-from]
'[?a :db/ident ?a2]]}
:args [(d/db conn)
from]})
(mapcat (fn [[src attr]]
[[:db/retract src attr from]
[:db/add src attr to]])))
transaction (conj transaction [:db/retractEntity from])]
@(d/transact conn transaction)
to))