adding accounts.

This commit is contained in:
Bryce Covert
2019-04-11 10:04:59 -07:00
parent 89ae2151ea
commit bde4bb4ecb
6 changed files with 83 additions and 18 deletions

View File

@@ -17,6 +17,7 @@
[auto-ap.datomic.invoices :as d-invoices]
[auto-ap.datomic.vendors :as d-vendors]
[auto-ap.graphql.users :as gq-users]
[auto-ap.graphql.accounts :as gq-accounts]
[auto-ap.graphql.clients :as gq-clients]
[auto-ap.graphql.vendors :as gq-vendors]
[auto-ap.graphql.checks :as gq-checks]
@@ -157,6 +158,13 @@
:parent {:type :expense_account
:resolve :get-expense-account-parent}}}
:account {:fields {:id {:type :id}
:numeric_code {:type 'Int}
:type {:type :ident}
:account_set {:type 'String}
:location {:type 'String}
:name {:type 'String}}}
:invoices_expense_accounts
{:fields {:id {:type :id}
:invoice_id {:type 'String}
@@ -214,12 +222,9 @@
:invoice_stat {:fields {:name {:type 'String}
:paid {:type 'String}
:unpaid {:type 'String}}}
}
:unpaid {:type 'String}}}}
:queries
{:expense_account_stats {:type '(list :expense_account_stat)
@@ -249,6 +254,10 @@
:statuses {:type '(list String)}}
:resolve :get-all-invoices}
:accounts {:type '(list :account)
:args {:account_set {:type 'String}}
:resolve :get-accounts}
:all_payments {:type '(list :payment)
:args {:client_id {:type :id}
:client_code {:type 'String}
@@ -569,6 +578,7 @@
:get-all-invoices gq-invoices/get-all-invoices
:get-all-payments get-all-payments
:get-payment-page gq-checks/get-payment-page
:get-accounts gq-accounts/get-accounts
:get-transaction-page gq-transactions/get-transaction-page
:get-expense-account-stats get-expense-account-stats
:get-invoice-stats get-invoice-stats
@@ -616,7 +626,7 @@
:else
node))
m))
(defn query
([id q]
(query id q nil ))
@@ -627,10 +637,12 @@
(when (seq (:errors result))
(throw (ex-info "GraphQL error" {:result result})))
result)
(catch Exception e
(if-let [v (:validation-error (ex-data e))]
(println "validation error" v)
(println e))
(throw e)))))
#_(query nil "{ accounts(account_set: \"default\") { numeric_code, name }}" nil)