(ns auto-ap.datomic.yodlee-merchants
  (:require
   [auto-ap.datomic :refer [conn]]
   [datomic.client.api :as dc]))

(defn get-merchants [_]
  ;; TODO admin?
  (let [query {:query {:find ['(pull ?e [:yodlee-merchant/name :yodlee-merchant/yodlee-id :db/id])]
                       :in ['$]
                       :where [['?e :yodlee-merchant/name]]}
               :args [(dc/db conn)]}]
    (->>
     (dc/q query)
     (mapv first))))
