made transactions more general.
This commit is contained in:
@@ -354,7 +354,7 @@
|
|||||||
:start {:type 'Int}
|
:start {:type 'Int}
|
||||||
:end {:type 'Int}}}
|
:end {:type 'Int}}}
|
||||||
|
|
||||||
:transaction_page {:fields {:transactions {:type '(list :transaction)}
|
:transaction_page {:fields {:data {:type '(list :transaction)}
|
||||||
:count {:type 'Int}
|
:count {:type 'Int}
|
||||||
:total {:type 'Int}
|
:total {:type 'Int}
|
||||||
:start {:type 'Int}
|
:start {:type 'Int}
|
||||||
@@ -492,18 +492,8 @@
|
|||||||
:args {}
|
:args {}
|
||||||
:resolve :get-yodlee-merchants}
|
:resolve :get-yodlee-merchants}
|
||||||
|
|
||||||
:transaction_page {:type '(list :transaction_page)
|
:transaction_page {:type :transaction_page
|
||||||
:args {:client_id {:type :id}
|
:args {:filters {:type :transaction_filters}}
|
||||||
: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}}
|
|
||||||
|
|
||||||
:resolve :get-transaction-page}
|
:resolve :get-transaction-page}
|
||||||
|
|
||||||
@@ -572,6 +562,18 @@
|
|||||||
{:fields {:sort_key {:type 'String}
|
{:fields {:sort_key {:type 'String}
|
||||||
:sort_name {:type 'String}
|
:sort_name {:type 'String}
|
||||||
:asc {:type 'Boolean}}}
|
: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}
|
:invoice_payment_amount {:fields {:invoice_id {:type :id}
|
||||||
:amount {:type 'Float}}}
|
:amount {:type 'Float}}}
|
||||||
:edit_location_match {:fields {:location {:type 'String}
|
:edit_location_match {:fields {:location {:type 'String}
|
||||||
@@ -807,11 +809,11 @@
|
|||||||
:resolve :mutation/add-and-print-invoice}
|
:resolve :mutation/add-and-print-invoice}
|
||||||
|
|
||||||
:print_checks {:type :check_result
|
:print_checks {:type :check_result
|
||||||
:args {:invoice_payments {:type '(list :invoice_payment_amount)}
|
:args {:invoice_payments {:type '(list :invoice_payment_amount)}
|
||||||
:bank_account_id {:type :id}
|
:bank_account_id {:type :id}
|
||||||
:type {:type :payment_type}
|
:type {:type :payment_type}
|
||||||
:client_id {:type :id}}
|
:client_id {:type :id}}
|
||||||
:resolve :mutation/print-checks}
|
:resolve :mutation/print-checks}
|
||||||
|
|
||||||
:add_handwritten_check {:type :check_result
|
:add_handwritten_check {:type :check_result
|
||||||
:args {:invoice_payments {:type '(list :invoice_payment_amount)}
|
:args {:invoice_payments {:type '(list :invoice_payment_amount)}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@
|
|||||||
|
|
||||||
(defn get-transaction-page [context args value]
|
(defn get-transaction-page [context args value]
|
||||||
(let [args (assoc args :id (:id context))
|
(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 (map ->graphql (map approval-status->graphql transactions))]
|
||||||
[{:transactions transactions
|
{:data transactions
|
||||||
:total transactions-count
|
:total transactions-count
|
||||||
:count (count transactions)
|
:count (count transactions)
|
||||||
:start (:start args 0)
|
:start (:start (:filters args) 0)
|
||||||
:end (+ (:start args 0) (count transactions))}]))
|
:end (+ (:start (:filters args) 0) (count transactions))}))
|
||||||
|
|
||||||
(defn unapprove-transactions [context args value]
|
(defn unapprove-transactions [context args value]
|
||||||
(let [args (assoc args :id (:id context))
|
(let [args (assoc args :id (:id context))
|
||||||
|
|||||||
@@ -32,19 +32,20 @@
|
|||||||
(fn [{:keys [db user] :as cofx} [_ params]]
|
(fn [{:keys [db user] :as cofx} [_ params]]
|
||||||
{:graphql {:token user
|
{:graphql {:token user
|
||||||
:owns-state {:single [::data-page/page ::page]}
|
:owns-state {:single [::data-page/page ::page]}
|
||||||
:query-obj {:venia/queries [[:transaction_rule_page
|
:query-obj {:venia/queries [{:query/data [:transaction_rule_page
|
||||||
{:sort (:sort params)
|
{:sort (:sort params)
|
||||||
:start (:start params 0)
|
:start (:start params 0)
|
||||||
:per-page (:per-page params)
|
:per-page (:per-page params)
|
||||||
:vendor-id (:id (:vendor params))
|
:vendor-id (:id (:vendor params))
|
||||||
:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
||||||
[[:transaction-rules default-read]
|
[[:transaction-rules default-read]
|
||||||
:total
|
:total
|
||||||
:start
|
:start
|
||||||
:end]]]}
|
:end]]
|
||||||
|
:query/alias :result}]}
|
||||||
:on-success (fn [result]
|
:on-success (fn [result]
|
||||||
[::data-page/received ::page
|
[::data-page/received ::page
|
||||||
(set/rename-keys (:transaction-rule-page result)
|
(set/rename-keys (:result result)
|
||||||
{:transaction-rules :data})])}}))
|
{:transaction-rules :data})])}}))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
|
|||||||
@@ -45,15 +45,16 @@
|
|||||||
(fn [{:keys [user db ]} [_ params]]
|
(fn [{:keys [user db ]} [_ params]]
|
||||||
{:graphql {:token user
|
{:graphql {:token user
|
||||||
:owns-state {:single [::data-page/page ::page]}
|
:owns-state {:single [::data-page/page ::page]}
|
||||||
:query-obj {:venia/queries [[:transaction_page
|
:query-obj {:venia/queries [{:query/data [:transaction_page
|
||||||
(data-params->query-params params)
|
{:filters (data-params->query-params params)}
|
||||||
[[:transactions transaction-read]
|
[[:data transaction-read]
|
||||||
:total
|
:total
|
||||||
:start
|
:start
|
||||||
:end]]]}
|
:end]]
|
||||||
|
:query/alias :result}]}
|
||||||
:on-success (fn [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
|
(re-frame/reg-event-fx
|
||||||
::unapprove-all
|
::unapprove-all
|
||||||
|
|||||||
Reference in New Issue
Block a user