made transactions more general.

This commit is contained in:
Bryce Covert
2020-08-25 07:00:16 -07:00
parent f20bbf9e75
commit bd2d10cf52
4 changed files with 47 additions and 43 deletions

View File

@@ -354,7 +354,7 @@
:start {:type 'Int}
:end {:type 'Int}}}
:transaction_page {:fields {:transactions {:type '(list :transaction)}
:transaction_page {:fields {:data {:type '(list :transaction)}
:count {:type 'Int}
:total {:type 'Int}
:start {:type 'Int}
@@ -492,18 +492,8 @@
:args {}
:resolve :get-yodlee-merchants}
:transaction_page {:type '(list :transaction_page)
:args {:client_id {:type :id}
:vendor_id {:type :id}
:bank_account_id {:type :id}
:date_range {:type :date_range}
:amount_lte {:type :money}
:amount_gte {:type :money}
:description {:type 'String}
:start {:type 'Int}
:per_page {:type 'Int}
:sort {:type '(list :sort_item)}
:approval_status {:type :transaction_approval_status}}
:transaction_page {:type :transaction_page
:args {:filters {:type :transaction_filters}}
:resolve :get-transaction-page}
@@ -572,6 +562,18 @@
{:fields {:sort_key {:type 'String}
:sort_name {:type 'String}
:asc {:type 'Boolean}}}
:transaction_filters {:fields {:client_id {:type :id}
:vendor_id {:type :id}
:bank_account_id {:type :id}
:date_range {:type :date_range}
:amount_lte {:type :money}
:amount_gte {:type :money}
:description {:type 'String}
:start {:type 'Int}
:per_page {:type 'Int}
:sort {:type '(list :sort_item)}
:approval_status {:type :transaction_approval_status} }}
:invoice_payment_amount {:fields {:invoice_id {:type :id}
:amount {:type 'Float}}}
:edit_location_match {:fields {:location {:type 'String}
@@ -807,11 +809,11 @@
:resolve :mutation/add-and-print-invoice}
:print_checks {:type :check_result
:args {:invoice_payments {:type '(list :invoice_payment_amount)}
:bank_account_id {:type :id}
:type {:type :payment_type}
:client_id {:type :id}}
:resolve :mutation/print-checks}
:args {:invoice_payments {:type '(list :invoice_payment_amount)}
:bank_account_id {:type :id}
:type {:type :payment_type}
:client_id {:type :id}}
:resolve :mutation/print-checks}
:add_handwritten_check {:type :check_result
:args {:invoice_payments {:type '(list :invoice_payment_amount)}

View File

@@ -23,13 +23,13 @@
(defn get-transaction-page [context args value]
(let [args (assoc args :id (:id context))
[transactions transactions-count] (d-transactions/get-graphql (update (<-graphql args) :approval-status enum->keyword "transaction-approval-status"))
[transactions transactions-count] (d-transactions/get-graphql (update (<-graphql (:filters args)) :approval-status enum->keyword "transaction-approval-status"))
transactions (map ->graphql (map approval-status->graphql transactions))]
[{:transactions transactions
:total transactions-count
:count (count transactions)
:start (:start args 0)
:end (+ (:start args 0) (count transactions))}]))
{:data transactions
:total transactions-count
:count (count transactions)
:start (:start (:filters args) 0)
:end (+ (:start (:filters args) 0) (count transactions))}))
(defn unapprove-transactions [context args value]
(let [args (assoc args :id (:id context))