made transactions more general.
This commit is contained in:
@@ -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)}
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -32,19 +32,20 @@
|
||||
(fn [{:keys [db user] :as cofx} [_ params]]
|
||||
{:graphql {:token user
|
||||
:owns-state {:single [::data-page/page ::page]}
|
||||
:query-obj {:venia/queries [[:transaction_rule_page
|
||||
{:sort (:sort params)
|
||||
:start (:start params 0)
|
||||
:per-page (:per-page params)
|
||||
:vendor-id (:id (:vendor params))
|
||||
:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
||||
[[:transaction-rules default-read]
|
||||
:total
|
||||
:start
|
||||
:end]]]}
|
||||
:query-obj {:venia/queries [{:query/data [:transaction_rule_page
|
||||
{:sort (:sort params)
|
||||
:start (:start params 0)
|
||||
:per-page (:per-page params)
|
||||
:vendor-id (:id (:vendor params))
|
||||
:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
||||
[[:transaction-rules default-read]
|
||||
:total
|
||||
:start
|
||||
:end]]
|
||||
:query/alias :result}]}
|
||||
:on-success (fn [result]
|
||||
[::data-page/received ::page
|
||||
(set/rename-keys (:transaction-rule-page result)
|
||||
(set/rename-keys (:result result)
|
||||
{:transaction-rules :data})])}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
|
||||
@@ -45,15 +45,16 @@
|
||||
(fn [{:keys [user db ]} [_ params]]
|
||||
{:graphql {:token user
|
||||
:owns-state {:single [::data-page/page ::page]}
|
||||
:query-obj {:venia/queries [[:transaction_page
|
||||
(data-params->query-params params)
|
||||
[[:transactions transaction-read]
|
||||
:total
|
||||
:start
|
||||
:end]]]}
|
||||
:query-obj {:venia/queries [{:query/data [:transaction_page
|
||||
{:filters (data-params->query-params params)}
|
||||
[[:data transaction-read]
|
||||
:total
|
||||
:start
|
||||
:end]]
|
||||
:query/alias :result}]}
|
||||
:on-success (fn [result]
|
||||
[::data-page/received ::page (set/rename-keys (first (:transaction-page result))
|
||||
{:transactions :data})])}}))
|
||||
|
||||
[::data-page/received ::page (:result result)])}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::unapprove-all
|
||||
|
||||
Reference in New Issue
Block a user