Files
integreat/src/clj/auto_ap/datomic/vendors.clj

34 lines
984 B
Clojure

(ns auto-ap.datomic.vendors
(:require [datomic.api :as d]
[auto-ap.datomic :refer [uri]]))
(defn get-graphql [args]
(prn (->> (d/q '[:find (pull ?e [*])
: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)))))))
(defn get-by-id [id]
(->> (d/q '[:find (pull ?e [* {:default-account [:account/name :db/id :account/location]}])
:in $ ?e
:where [?e]]
(d/db (d/connect uri))
id)
(map first)
(first)
))