(cloud) Saving things now update the search index

This commit is contained in:
2023-05-04 21:23:09 -07:00
parent 4e7e19da97
commit 14156e6ced
6 changed files with 71 additions and 38 deletions

View File

@@ -27,7 +27,8 @@
[clojure.tools.logging :as log]
[datomic.api :as dc]
[iol-ion.tx :refer [random-tempid]]
[com.brunobonacci.mulog :as mu]))
[com.brunobonacci.mulog :as mu]
[auto-ap.solr :as solr]))
(def approval-status->graphql (ident->enum-f :transaction/approval-status))
@@ -369,6 +370,7 @@
:transaction/accounts (map transaction-account->entity accounts)
:transaction/forecast-match forecast_match}]]
(:id context))
(solr/touch-with-ledger id)
(-> (d-transactions/get-by-id id)
approval-status->graphql
->graphql)))
@@ -403,6 +405,7 @@
:transaction-account/location "A"
:transaction-account/amount (Math/abs (:transaction/amount transaction))}]}]])
(:id context)))
(solr/touch-with-ledger transaction_id)
(-> (d-transactions/get-by-id transaction_id)
approval-status->graphql
->graphql))
@@ -437,7 +440,7 @@
(:db/id (:transaction/client transaction)))]
(log/info "Adding a new payment" payment-tx)
(audit-transact payment-tx (:id context)))
(solr/touch-with-ledger transaction_id)
(-> (d-transactions/get-by-id transaction_id)
approval-status->graphql
->graphql)))
@@ -475,6 +478,7 @@
(:db/id (:transaction/bank-account transaction))
(:db/id (:transaction/client transaction)))]
(audit-transact payment-tx (:id context)))
(solr/touch-with-ledger transaction_id)
(-> (d-transactions/get-by-id transaction_id)
approval-status->graphql
@@ -505,7 +509,7 @@
(when (not (rm/rule-applies? transaction transaction-rule))
(throw (ex-info "Transaction rule does not apply" {:validation-error "Transaction rule does not apply"
:transaction-rule transaction-rule
:transaction transaction})))
:transaction transaction})))
(when (:transaction/payment transaction)
@@ -520,6 +524,9 @@
(-> t :transaction/client :client/locations))))])
transactions)
(:id context))
(doseq [n transactions]
(solr/touch-with-ledger (:db/id n)))
)
(transduce
(comp