(ns auto-ap.datomic.yodlee-merchants
  (:require [datomic.api :as d]
            [auto-ap.graphql.utils :refer [->graphql]]
            [auto-ap.datomic :refer [uri merge-query]]))

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