more code trimming for datomic.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
[auto-ap.db.companies :as companies]
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.checks :as d-checks]
|
||||
[auto-ap.datomic.users :as d-users]
|
||||
[auto-ap.datomic.invoices :as d-invoices]
|
||||
[auto-ap.datomic.vendors :as d-vendors]
|
||||
[auto-ap.db.users :as users]
|
||||
@@ -89,8 +90,7 @@
|
||||
:body {:type 'String}
|
||||
:scheduled {:type 'String}
|
||||
:sent {:type 'String}
|
||||
:vendor {:type :vendor
|
||||
:resolve :get-vendor-for-invoice}
|
||||
:vendor {:type :vendor}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,8 +145,7 @@
|
||||
{:fields {:id {:type 'Int}
|
||||
:name {:type 'String}
|
||||
:role {:type 'String}
|
||||
:companies {:type '(list :company)
|
||||
:resolve :get-user-companies}}}
|
||||
:clients {:type '(list :company)}}}
|
||||
|
||||
:expense_account {:fields {:id {:type 'Int}
|
||||
:location {:type 'String}
|
||||
@@ -407,29 +406,14 @@
|
||||
:start (:start args 0)
|
||||
:end (+ (:start args 0) (count reminders))}] extra-context)))
|
||||
|
||||
(defn get-vendor-for-invoice [context args value]
|
||||
(->graphql
|
||||
(if-let [vendor-cache (:vendor-cache context)]
|
||||
(vendor-cache (:vendor_id value))
|
||||
(vendors/get-by-id (:vendor_id value)))))
|
||||
|
||||
(defn get-check-by-id [context args value]
|
||||
(->graphql
|
||||
(checks/get-by-id (:check_id value))))
|
||||
|
||||
(defn get-invoices-checks [context args value]
|
||||
(->graphql
|
||||
(invoices-checks/get-for-invoice-id (:id value))))
|
||||
|
||||
(defn get-checks-invoices [context args value]
|
||||
(->graphql
|
||||
(invoices-checks/get-for-check-id (:id value))))
|
||||
|
||||
(defn get-company-for-invoice [context args value]
|
||||
(->graphql
|
||||
(if-let [company-cache (:company-cache context)]
|
||||
(company-cache (:company_id value))
|
||||
(companies/get-by-id (:company_id value)))))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(defn bank-account-for-check [context args value]
|
||||
(->graphql
|
||||
@@ -461,13 +445,8 @@
|
||||
(defn get-user [context args value]
|
||||
(assert-admin (:id context))
|
||||
|
||||
(let [
|
||||
users (users/get-all)
|
||||
|
||||
extra-context (cond-> context
|
||||
(executor/selects-field? context :user/companies) (assoc :company-cache (by :id (companies/get-all))))]
|
||||
(resolve/with-context
|
||||
(->graphql users) extra-context)))
|
||||
(let [users (d-users/get-graphql args)]
|
||||
(->graphql users)))
|
||||
|
||||
(defn get-vendor [context args value]
|
||||
(->graphql
|
||||
@@ -495,13 +474,6 @@
|
||||
: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
|
||||
:get-check-for-transaction gq-transactions/get-check-for-transaction
|
||||
:get-company-for-invoice get-company-for-invoice
|
||||
:get-invoices-checks get-invoices-checks
|
||||
:get-checks-invoices get-checks-invoices
|
||||
:get-check-by-id get-check-by-id
|
||||
:get-invoices-expense-accounts gq-invoices/get-invoices-expense-accounts
|
||||
:get-company get-company
|
||||
:get-user get-user
|
||||
:get-user-companies get-user-companies
|
||||
|
||||
Reference in New Issue
Block a user