more conversion to datomic
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
[auto-ap.db.vendors :as vendors]
|
||||
[auto-ap.db.companies :as companies]
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.checks :as d-checks]
|
||||
[auto-ap.datomic.invoices :as d-invoices]
|
||||
[auto-ap.datomic.vendors :as d-vendors]
|
||||
[auto-ap.db.users :as users]
|
||||
@@ -101,8 +102,7 @@
|
||||
:vendor {:type :vendor}
|
||||
:company {:type :company}
|
||||
:date {:type 'String}
|
||||
:bank_account {:type :bank_account
|
||||
:resolve :bank-account-for-check}
|
||||
:bank_account {:type :bank_account}
|
||||
:memo {:type 'String}
|
||||
:s3_url {:type 'String}
|
||||
:check_number {:type 'Int}
|
||||
@@ -116,8 +116,7 @@
|
||||
:vendor {:type :vendor}
|
||||
:client {:type :client}
|
||||
:date {:type 'String}
|
||||
:bank_account {:type :bank_account
|
||||
:resolve :bank-account-for-check}
|
||||
:bank_account {:type :bank_account}
|
||||
:memo {:type 'String}
|
||||
:s3_url {:type 'String}
|
||||
:check_number {:type 'Int}
|
||||
@@ -139,7 +138,8 @@
|
||||
:amount {:type 'String}
|
||||
:invoice_id {:type 'String}
|
||||
:payment_id {:type 'String}
|
||||
:payment {:type :payment}}}
|
||||
:payment {:type :payment}
|
||||
:invoice {:type :invoice}}}
|
||||
|
||||
:user
|
||||
{:fields {:id {:type 'Int}
|
||||
@@ -160,8 +160,7 @@
|
||||
:expense_account_id {:type 'Int}
|
||||
:location {:type 'String}
|
||||
:expense_account {:type :expense_account
|
||||
:resolve :get-expense-account
|
||||
|
||||
:resolve :get-expense-account
|
||||
}
|
||||
:amount {:type 'String}}}
|
||||
|
||||
@@ -184,7 +183,7 @@
|
||||
:start {:type 'Int}
|
||||
:end {:type 'Int}}}
|
||||
|
||||
:payment_page {:fields {:checks {:type '(list :payment)}
|
||||
:payment_page {:fields {:payments {:type '(list :payment)}
|
||||
:count {:type 'Int}
|
||||
:total {:type 'Int}
|
||||
:start {:type 'Int}
|
||||
@@ -218,12 +217,14 @@
|
||||
:resolve :get-invoice-page}
|
||||
|
||||
:all_invoices {:type '(list :invoice)
|
||||
:args {:company_id {:type 'Int}}
|
||||
:args {:client_id {:type 'String}
|
||||
:original_id {:type 'Int}}
|
||||
:resolve :get-all-invoices}
|
||||
|
||||
:all_checks {:type '(list :payment)
|
||||
:args {:company_id {:type 'Int}}
|
||||
:resolve :get-all-checks}
|
||||
:all_payments {:type '(list :payment)
|
||||
:args {:client_id {:type 'String}
|
||||
:original_id {:type 'Int}}
|
||||
:resolve :get-all-payments}
|
||||
|
||||
:transaction_page {:type '(list :transaction_page)
|
||||
:args {:company_id {:type 'String}
|
||||
@@ -234,12 +235,12 @@
|
||||
:resolve :get-transaction-page}
|
||||
|
||||
:payment_page {:type '(list :payment_page)
|
||||
:args {:company_id {:type 'Int}
|
||||
:args {:client_id {:type 'String}
|
||||
:start {:type 'Int}
|
||||
:sort_by {:type 'String}
|
||||
:asc {:type 'Boolean}}
|
||||
|
||||
:resolve :get-check-page}
|
||||
:resolve :get-payment-page}
|
||||
:reminder_page {:type '(list :reminder_page)
|
||||
:args {:start {:type 'Int}
|
||||
:sort_by {:type 'String}
|
||||
@@ -377,34 +378,17 @@
|
||||
|
||||
(defn get-all-invoices [context args value]
|
||||
(assert-admin (:id context))
|
||||
(let [extra-context
|
||||
(cond-> {}
|
||||
(executor/selects-field? context :invoice/vendor) (assoc :vendor-cache (by :id (vendors/get-all)))
|
||||
(executor/selects-field? context :invoice/company) (assoc :company-cache (by :id (companies/get-all))))
|
||||
|
||||
(map
|
||||
->graphql
|
||||
(d-invoices/get-graphql (assoc (<-graphql args)
|
||||
:limit Integer/MAX_VALUE))))
|
||||
|
||||
invoices (map
|
||||
->graphql
|
||||
(invoices/get-graphql (assoc (<-graphql args)
|
||||
:limit Integer/MAX_VALUE)))]
|
||||
(resolve/with-context
|
||||
invoices extra-context)))
|
||||
|
||||
(defn get-all-checks [context args value]
|
||||
(defn get-all-payments [context args value]
|
||||
(assert-admin (:id context))
|
||||
(let [extra-context
|
||||
(cond-> {}
|
||||
(executor/selects-field? context :invoice/vendor) (assoc :vendor-cache (by :id (vendors/get-all)))
|
||||
(or (executor/selects-field? context :check/company)
|
||||
(executor/selects-field? context :check/bank_account)) (assoc :company-cache (by :id (companies/get-all))))
|
||||
|
||||
|
||||
checks (map
|
||||
->graphql
|
||||
(checks/get-graphql (assoc (<-graphql args)
|
||||
:limit Integer/MAX_VALUE)))]
|
||||
(resolve/with-context
|
||||
checks extra-context)))
|
||||
(map
|
||||
->graphql
|
||||
(d-checks/get-graphql (assoc (<-graphql args)
|
||||
:limit Integer/MAX_VALUE))))
|
||||
|
||||
(defn get-reminder-page [context args value]
|
||||
(assert-admin (:id context))
|
||||
@@ -506,9 +490,9 @@
|
||||
(-> integreat-schema
|
||||
(attach-resolvers {:get-invoice-page get-invoice-page
|
||||
:get-all-invoices get-all-invoices
|
||||
:get-all-checks get-all-checks
|
||||
:get-all-payments get-all-payments
|
||||
:bank-account-for-check bank-account-for-check
|
||||
:get-check-page gq-checks/get-check-page
|
||||
:get-payment-page gq-checks/get-payment-page
|
||||
:get-transaction-page gq-transactions/get-transaction-page
|
||||
:get-reminder-page get-reminder-page
|
||||
:get-vendor-for-invoice get-vendor-for-invoice
|
||||
|
||||
Reference in New Issue
Block a user