diff --git a/src/clj/auto_ap/graphql.clj b/src/clj/auto_ap/graphql.clj index b11533ff..4bb80e34 100644 --- a/src/clj/auto_ap/graphql.clj +++ b/src/clj/auto_ap/graphql.clj @@ -372,6 +372,10 @@ :sort {:type '(list :sort_item)}} :resolve :get-accounts} + :all_accounts {:type '(list :account) + :args {} + :resolve :get-all-accounts} + :search_vendor {:type '(list :search_result) :args {:query {:type 'String}} :resolve :search-vendor} @@ -810,6 +814,7 @@ :get-yodlee-provider-account-page gq-yodlee2/get-yodlee-provider-account-page :get-all-sales-orders get-all-sales-orders :get-accounts gq-accounts/get-graphql + :get-all-accounts gq-accounts/get-all-graphql :get-sales-order-page gq-sales-orders/get-sales-orders-page :get-transaction-rule-page gq-transaction-rules/get-transaction-rule-page :get-transaction-rule-matches gq-transaction-rules/get-transaction-rule-matches diff --git a/src/clj/auto_ap/graphql/accounts.clj b/src/clj/auto_ap/graphql/accounts.clj index 1e442977..35a1f4aa 100644 --- a/src/clj/auto_ap/graphql/accounts.clj +++ b/src/clj/auto_ap/graphql/accounts.clj @@ -18,6 +18,12 @@ [accounts accounts-count ] (d-accounts/get-graphql (<-graphql args))] (result->page accounts accounts-count :accounts args))) +(defn get-all-graphql [context args _] + (assert-admin (:id context)) + (let [args (assoc args :id (:id context)) + [accounts accounts-count ] (d-accounts/get-graphql (assoc (<-graphql args) :per-page Integer/MAX_VALUE))] + accounts)) + (defn default-for-vendor [context args _] (assert-can-see-client (:id context) (:client_id args)) (let [result (d-accounts/get-for-vendor (:vendor_id args) (:client_id args))] diff --git a/src/clj/auto_ap/routes/exports.clj b/src/clj/auto_ap/routes/exports.clj index e186ae17..ed9b4439 100644 --- a/src/clj/auto_ap/routes/exports.clj +++ b/src/clj/auto_ap/routes/exports.clj @@ -279,7 +279,7 @@ (statsd/time! [(str "export.time") {:tags #{(client-tag query-params) "export:accounts"}}] (let [client-id (d-clients/code->id (query-params "client-code")) - query [[:accounts + query [[:all-accounts [:id :numeric_code :type :applicability :location :name [:client_overrides [:name [:client [:id :code :name]]]]]]] all-accounts (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))] @@ -302,7 +302,7 @@ (dissoc :client-overrides)))))) conj (list) - (:accounts (:data all-accounts))))))) + (:all-accounts (:data all-accounts))))))) (GET "/transactions/export" {:keys [query-params identity]} (assert-admin identity)