Files
integreat/src/clj/auto_ap/datomic/vendors.clj
2018-11-12 08:26:47 -08:00

33 lines
981 B
Clojure

(ns auto-ap.datomic.vendors
(:require [datomic.api :as d]
[auto-ap.datomic :refer [uri]]))
(defn get-graphql [args]
(->> (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)))))))
(defn get-by-id [id]
(->> (d/q '[:find (pull ?e [*])
:in $ ?e
:where [?e]]
(d/db (d/connect uri))
id)
(map first)
(first)
#_(map (fn [c]
(update c :client/bank-accounts
(fn [bas]
(map (fn [ba]
(update ba :bank-account/type :db/ident ))
bas)))))))