Made exact match id work better and override everything else

This commit is contained in:
2022-07-17 08:37:10 -07:00
parent d97d70e08f
commit a17f587ff3
4 changed files with 79 additions and 67 deletions

View File

@@ -20,28 +20,31 @@
[auto-ap.views.pages.data-page :as data-page])) [auto-ap.views.pages.data-page :as data-page]))
(defn data-params->query-params [params] (defn data-params->query-params [params]
{:exact-match-id (some-> params :exact-match-id str) (if (:exact-match-id params)
:start (:start params 0) {:exact-match-id (some-> params :exact-match-id str)
:sort (:sort params) :client-id (:id @(re-frame/subscribe [::subs/client]))}
:per-page (:per-page params) {:exact-match-id (some-> params :exact-match-id str)
:start (:start params 0)
:sort (:sort params)
:per-page (:per-page params)
:vendor-id (:id (:vendor params)) :vendor-id (:id (:vendor params))
:date-range (:date-range params) :date-range (:date-range params)
:due-range (:due-range params) :due-range (:due-range params)
:amount-gte (:amount-gte (:amount-range params)) :amount-gte (:amount-gte (:amount-range params))
:amount-lte (:amount-lte (:amount-range params)) :amount-lte (:amount-lte (:amount-range params))
:location (:location params) :location (:location params)
:unresolved (:unresolved params) :unresolved (:unresolved params)
:scheduled-payments (:scheduled-payments params) :scheduled-payments (:scheduled-payments params)
:invoice-number-like (:invoice-number-like params) :invoice-number-like (:invoice-number-like params)
:client-id (:id @(re-frame/subscribe [::subs/client])) :client-id (:id @(re-frame/subscribe [::subs/client]))
:import-status (:import-status params) :import-status (:import-status params)
:status (condp = @(re-frame/subscribe [::subs/active-page]) :status (condp = @(re-frame/subscribe [::subs/active-page])
:invoices nil :invoices nil
:import-invoices nil :import-invoices nil
:unpaid-invoices :unpaid :unpaid-invoices :unpaid
:paid-invoices :paid :paid-invoices :paid
:voided-invoices :voided)}) :voided-invoices :voided)}))
(defn query [params] (defn query [params]
{:venia/queries [[:invoice_page {:venia/queries [[:invoice_page

View File

@@ -17,19 +17,22 @@
[vimsical.re-frame.fx.track :as track])) [vimsical.re-frame.fx.track :as track]))
(defn data-params->query-params [params] (defn data-params->query-params [params]
{:start (:start params 0) (if (:exact-match-id params)
:per-page (:per-page params) {:client-id (:id @(re-frame/subscribe [::subs/client]))
:sort (:sort params) :exact-match-id (some-> (:exact-match-id params) str)}
:client-id (:id @(re-frame/subscribe [::subs/client])) {:start (:start params 0)
:vendor-id (:id (:vendor params)) :per-page (:per-page params)
:payment-type (:payment-type params) :sort (:sort params)
:status (:status params) :client-id (:id @(re-frame/subscribe [::subs/client]))
:exact-match-id (some-> (:exact-match-id params) str) :vendor-id (:id (:vendor params))
:date-range (:date-range params) :payment-type (:payment-type params)
:amount-gte (:amount-gte (:amount-range params)) :status (:status params)
:amount-lte (:amount-lte (:amount-range params))
:check-number-like (str (:check-number-like params)) :date-range (:date-range params)
:invoice-number (:invoice-number params)}) :amount-gte (:amount-gte (:amount-range params))
:amount-lte (:amount-lte (:amount-range params))
:check-number-like (str (:check-number-like params))
:invoice-number (:invoice-number params)}))
(re-frame/reg-event-fx (re-frame/reg-event-fx
::params-change ::params-change

View File

@@ -15,18 +15,21 @@
(re-frame/reg-event-fx (re-frame/reg-event-fx
::params-change ::params-change
[with-user] [with-user]
(fn [{:keys [user db ]}[_ params]] (fn [{:keys [user]}[_ 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 [[:expected_deposit_page :query-obj {:venia/queries [[:expected_deposit_page
{:start (:start params 0) (if (:exact-match-id params)
:sort (:sort params) {:exact-match-id (some-> (:exact-match-id params) str)
:per-page (:per-page params) :client-id (:id @(re-frame/subscribe [::subs/client]))}
:exact-match-id (some-> (:exact-match-id params) str) {:start (:start params 0)
:total-gte (:amount-gte (:total-range params)) :sort (:sort params)
:total-lte (:amount-lte (:total-range params)) :per-page (:per-page params)
:date-range (:date-range params) :exact-match-id (some-> (:exact-match-id params) str)
:client-id (:id @(re-frame/subscribe [::subs/client]))} :total-gte (:amount-gte (:total-range params))
:total-lte (:amount-lte (:total-range params))
:date-range (:date-range params)
:client-id (:id @(re-frame/subscribe [::subs/client]))})
[[:expected-deposits [:id :total :fee :location :date :status [[:expected-deposits [:id :total :fee :location :date :status
[:totals [:date :count :amount]] [:totals [:date :count :amount]]
[:transaction [:id :date]] [:transaction [:id :date]]
@@ -42,13 +45,13 @@
(re-frame/reg-event-fx (re-frame/reg-event-fx
::unmounted ::unmounted
(fn [{:keys [db]} _] (fn [_ _]
{:dispatch [::data-page/dispose ::page] {:dispatch [::data-page/dispose ::page]
::track/dispose {:id ::params}})) ::track/dispose {:id ::params}}))
(re-frame/reg-event-fx (re-frame/reg-event-fx
::mounted ::mounted
(fn [{:keys [db]} _] (fn [_ _]
{::track/register {:id ::params {::track/register {:id ::params
:subscription [::data-page/params ::page] :subscription [::data-page/params ::page]
:event-fn (fn [params] :event-fn (fn [params]

View File

@@ -23,25 +23,28 @@
[:bank-account [:name :yodlee-account-id :current-balance]]]) [:bank-account [:name :yodlee-account-id :current-balance]]])
(defn data-params->query-params [params] (defn data-params->query-params [params]
{:start (:start params 0) (if (:exact-match-id params)
:per-page (:per-page params) {:client-id (:id @(re-frame/subscribe [::subs/client]))
:sort (:sort params) :exact-match-id (some-> (:exact-match-id params) str)}
:client-id (:id @(re-frame/subscribe [::subs/client])) {:start (:start params 0)
:vendor-id (:id (:vendor params)) :per-page (:per-page params)
:date-range (:date-range params) :sort (:sort params)
:account-id (:id (:account params)) :client-id (:id @(re-frame/subscribe [::subs/client]))
:bank-account-id (:id (:bank-account params)) :vendor-id (:id (:vendor params))
:amount-gte (:amount-gte (:amount-range params)) :date-range (:date-range params)
:exact-match-id (some-> (:exact-match-id params) str) :account-id (:id (:account params))
:unresolved (:unresolved params) :bank-account-id (:id (:bank-account params))
:potential-duplicates (:potential-duplicates params) :amount-gte (:amount-gte (:amount-range params))
:location (:location params) :exact-match-id (some-> (:exact-match-id params) str)
:import-batch-id (some-> (:import-batch-id params) str) :unresolved (:unresolved params)
:amount-lte (:amount-lte (:amount-range params)) :potential-duplicates (:potential-duplicates params)
:description (:description params) :location (:location params)
:approval-status (condp = @(re-frame/subscribe [::subs/active-page]) :import-batch-id (some-> (:import-batch-id params) str)
:transactions nil :amount-lte (:amount-lte (:amount-range params))
:unapproved-transactions :unapproved :description (:description params)
:requires-feedback-transactions :requires-feedback :approval-status (condp = @(re-frame/subscribe [::subs/active-page])
:excluded-transactions :excluded :transactions nil
:approved-transactions :approved)}) :unapproved-transactions :unapproved
:requires-feedback-transactions :requires-feedback
:excluded-transactions :excluded
:approved-transactions :approved)}))