switched to graphql to create a payment.

This commit is contained in:
Bryce Covert
2018-05-14 09:30:01 -07:00
parent fd2164e8ba
commit bbd9f00f30
5 changed files with 85 additions and 14 deletions

View File

@@ -9,6 +9,7 @@
[auto-ap.db.vendors :as vendors]
[auto-ap.db.companies :as companies]
[auto-ap.db.checks :as checks]
[auto-ap.routes.checks :as rchecks]
[auto-ap.db.reminders :as reminders]
[auto-ap.db.invoices-checks :as invoices-checks]
[auto-ap.db.utils :as utils]
@@ -17,6 +18,7 @@
(:import
(clojure.lang IPersistentMap)))
(def integreat-schema
{
:objects
@@ -77,7 +79,13 @@
:count {:type 'Int}
:total {:type 'Int}
:start {:type 'Int}
:end {:type 'Int}}}}
:end {:type 'Int}}}
:check_result {:fields {:invoices {:type '(list :invoice)}
:pdf_url {:type 'String}}}
}
:queries
{:invoice_page {:type '(list :invoice_page)
:args {:imported {:type 'Boolean}
@@ -96,7 +104,12 @@
:company {:type '(list :company)
:resolve :get-company}
:vendor {:type '(list :vendor)
:resolve :get-vendor}}})
:resolve :get-vendor}}
:mutations
{:print_checks {:type :check_result
:args {:invoice_ids {:type '(list Int)}}
:resolve :mutation/print-checks}}})
(defn by [x kf]
(reduce
@@ -202,6 +215,11 @@
(->graphql
(vendors/get-all)))
(defn print-checks [context args value]
(->graphql
(rchecks/print-checks (:invoice_ids args))))
(def schema
(-> integreat-schema
(attach-resolvers {:get-invoice-page get-invoice-page
@@ -211,6 +229,7 @@
:get-invoices-checks get-invoices-checks
:get-check-by-id get-check-by-id
:get-company get-company
:mutation/print-checks print-checks
:get-vendor get-vendor})
schema/compile))