graphql updates.
This commit is contained in:
@@ -34,15 +34,19 @@
|
||||
:company_id {:type 'Int}
|
||||
:vendor {:type :vendor
|
||||
|
||||
:resolve :get-vendor}
|
||||
:resolve :get-vendor-for-invoice}
|
||||
:company {:type :company
|
||||
:resolve :get-company}}}}
|
||||
:resolve :get-company-for-invoice}}}}
|
||||
:queries
|
||||
{:invoice {:type '(list :invoice)
|
||||
:args {:imported {:type 'Boolean}
|
||||
:company_id {:type 'Int}}
|
||||
|
||||
:resolve :get-invoice}}})
|
||||
:resolve :get-invoice}
|
||||
:company {:type '(list :company)
|
||||
:resolve :get-company}
|
||||
:vendor {:type '(list :vendor)
|
||||
:resolve :get-vendor}}})
|
||||
|
||||
(defn by [x kf]
|
||||
(reduce
|
||||
@@ -99,23 +103,33 @@
|
||||
->graphql
|
||||
(invoices/get-graphql (<-graphql args))) extra-context)))
|
||||
|
||||
(defn get-vendor [context args value]
|
||||
(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-company [context args 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 get-company [context args value]
|
||||
(->graphql
|
||||
(companies/get-all)))
|
||||
|
||||
(defn get-vendor [context args value]
|
||||
(->graphql
|
||||
(vendors/get-all)))
|
||||
|
||||
(def schema
|
||||
(-> integreat-schema
|
||||
(attach-resolvers {:get-invoice get-invoice
|
||||
:get-vendor get-vendor
|
||||
:get-company get-company})
|
||||
:get-vendor-for-invoice get-vendor-for-invoice
|
||||
:get-company-for-invoice get-company-for-invoice
|
||||
:get-company get-company
|
||||
:get-vendor get-vendor})
|
||||
schema/compile))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user