refactoring to support grouping simply.

This commit is contained in:
Bryce Covert
2018-05-14 13:33:04 -07:00
parent 431645ad42
commit d9994b988c
7 changed files with 59 additions and 37 deletions

View File

@@ -32,7 +32,10 @@
:bank_account
{:fields {:id {:type 'Int}
:number {:type 'String}
:check_number {:type 'Int}}}
:check_number {:type 'Int}
:name {:type 'String}
:bank_code {:type 'String}
:bank_name {:type 'String}}}
:vendor
{:fields {:id {:type 'Int}
:name {:type 'String}
@@ -88,6 +91,8 @@
:end {:type 'Int}}}
:check_result {:fields {:invoices {:type '(list :invoice)}
:pdf_url {:type 'String}}}
}
@@ -112,9 +117,15 @@
:vendor {:type '(list :vendor)
:resolve :get-vendor}}
:input-objects
{
:invoice_payment {:fields {:invoice_id {:type 'Int}
:amount {:type 'Float}}}
}
:mutations
{:print_checks {:type :check_result
:args {:invoice_ids {:type '(list Int)}
:args {:invoice_payments {:type '(list :invoice_payment)}
:bank_account_id {:type 'Int}
:company_id {:type 'Int}}
:resolve :mutation/print-checks}}})
@@ -225,7 +236,9 @@
(defn print-checks [context args value]
(->graphql
(rchecks/print-checks (:invoice_ids args)
(rchecks/print-checks (map (fn [i] {:invoice-id (:invoice_id i)
:amount (:amount i)})
(:invoice_payments args))
(:company_id args)
(:bank_account_id args))))