you can add overrides.

This commit is contained in:
Bryce Covert
2020-04-19 14:38:55 -07:00
parent 5579fc95b2
commit a48ee8dd52
6 changed files with 179 additions and 103 deletions

View File

@@ -3,31 +3,23 @@
[auto-ap.datomic :refer [uri]]))
(defn get-graphql [args]
(prn (->> (d/q '[:find (pull ?e [*])
(->> (d/q '[:find (pull ?e [* {:vendor/account-overrides [* {:vendor-account-override/client [:client/name :db/id]
:vendor-account-override/account [:account/name :account/numeric-code :db/id]}]
:vendor/terms-overrides [* {:vendor-terms-override/client [:client/name :db/id]}]}])
:where [?e :vendor/name]]
(d/db (d/connect uri)))
(map first)
(take 5)))
(->> (d/q '[:find (pull ?e [*])
:where [?e :vendor/name]]
(d/db (d/connect uri)))
(map first)
#_(map (fn [c]
(update c :client/bank-accounts
(fn [bas]
(map (fn [ba]
(update ba :bank-account/type :db/ident ))
bas)))))))
(map first)))
(defn get-by-id [id]
(->> (d/q '[:find (pull ?e [* {:default-account [:account/name :db/id :account/location]}])
(->> (d/q '[:find (pull ?e [*
{:default-account [:account/name :db/id :account/location]
:vendor/account-overrides [* {:vendor-account-override/client [:client/name :db/id]
:vendor-account-override/account [:account/name :account/numeric-code :db/id]}]
:vendor/terms-overrides [* {:vendor-terms-override/client [:client/name :db/id]}]}])
:in $ ?e
:where [?e]]
(d/db (d/connect uri))
id)
(map first)
(first)
))
(first)))