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,6 +20,9 @@
[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]
(if (:exact-match-id params)
{:exact-match-id (some-> params :exact-match-id str)
:client-id (:id @(re-frame/subscribe [::subs/client]))}
{:exact-match-id (some-> params :exact-match-id str) {:exact-match-id (some-> params :exact-match-id str)
:start (:start params 0) :start (:start params 0)
:sort (:sort params) :sort (:sort params)
@@ -41,7 +44,7 @@
: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,6 +17,9 @@
[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]
(if (:exact-match-id params)
{:client-id (:id @(re-frame/subscribe [::subs/client]))
:exact-match-id (some-> (:exact-match-id params) str)}
{:start (:start params 0) {:start (:start params 0)
:per-page (:per-page params) :per-page (:per-page params)
:sort (:sort params) :sort (:sort params)
@@ -24,12 +27,12 @@
:vendor-id (:id (:vendor params)) :vendor-id (:id (:vendor params))
:payment-type (:payment-type params) :payment-type (:payment-type params)
:status (:status params) :status (:status params)
:exact-match-id (some-> (:exact-match-id params) str)
:date-range (:date-range params) :date-range (:date-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))
:check-number-like (str (:check-number-like params)) :check-number-like (str (:check-number-like params))
:invoice-number (:invoice-number params)}) :invoice-number (:invoice-number params)}))
(re-frame/reg-event-fx (re-frame/reg-event-fx
::params-change ::params-change

View File

@@ -15,10 +15,13 @@
(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
(if (:exact-match-id params)
{:exact-match-id (some-> (:exact-match-id params) str)
:client-id (:id @(re-frame/subscribe [::subs/client]))}
{:start (:start params 0) {:start (:start params 0)
:sort (:sort params) :sort (:sort params)
:per-page (:per-page params) :per-page (:per-page params)
@@ -26,7 +29,7 @@
:total-gte (:amount-gte (:total-range params)) :total-gte (:amount-gte (:total-range params))
:total-lte (:amount-lte (:total-range params)) :total-lte (:amount-lte (:total-range params))
:date-range (:date-range params) :date-range (:date-range params)
:client-id (:id @(re-frame/subscribe [::subs/client]))} :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,6 +23,9 @@
[: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]
(if (:exact-match-id params)
{:client-id (:id @(re-frame/subscribe [::subs/client]))
:exact-match-id (some-> (:exact-match-id params) str)}
{:start (:start params 0) {:start (:start params 0)
:per-page (:per-page params) :per-page (:per-page params)
:sort (:sort params) :sort (:sort params)
@@ -44,4 +47,4 @@
:unapproved-transactions :unapproved :unapproved-transactions :unapproved
:requires-feedback-transactions :requires-feedback :requires-feedback-transactions :requires-feedback
:excluded-transactions :excluded :excluded-transactions :excluded
:approved-transactions :approved)}) :approved-transactions :approved)}))