(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

@@ -35,7 +35,8 @@
[config.core :refer [env]]
[clj-time.coerce :as coerce]
[datomic.api :as dc]
[digest])
[digest]
[auto-ap.solr :as solr])
(:import
(java.io ByteArrayOutputStream)
(java.text DecimalFormat)
@@ -414,11 +415,12 @@
(make-pdfs (filter #(and (= :payment-type/check (:payment/type %))
(> (:payment/amount %) 0.0))
checks))))
(audit-transact (map #(if (map? %)
(dissoc % :payment/pdf-data)
%) checks ) id)
(let [result (audit-transact (map #(if (map? %)
(dissoc % :payment/pdf-data)
%) checks ) id)]
(doseq [i (:tempids result)]
(solr/touch-with-ledger i)))
{:invoices (d-invoices/get-multi (map :invoice-id invoice-payments))
:pdf-url (if (= type :payment-type/check)
(mu/trace ::merge-pdfs
@@ -475,14 +477,16 @@
0
invoice-payment-lookup)]
(audit-transact
(into [(assoc base-payment
:payment/type :payment-type/check
:payment/status :payment-status/pending
:payment/check-number (:check_number args)
:payment/date (c/to-date (parse (:date args) iso-date)))]
(invoice-payments invoices invoice-payment-lookup))
(:id context))
(let [result (audit-transact
(into [(assoc base-payment
:payment/type :payment-type/check
:payment/status :payment-status/pending
:payment/check-number (:check_number args)
:payment/date (c/to-date (parse (:date args) iso-date)))]
(invoice-payments invoices invoice-payment-lookup))
(:id context))]
(doseq [i (:tempids result)]
(solr/touch-with-ledger i)))
(->graphql
{:s3-url nil
:invoices (d-invoices/get-multi (map :invoice_id (:invoice_payments args)))})))
@@ -648,9 +652,11 @@
:payment/type :payment-type/balance-credit
:payment/status :payment-status/cleared}]
(audit-transact (-> []
(conj payment)
(into (invoice-payments invoices invoice-amounts))) (:id context))
(let [result (audit-transact (-> []
(conj payment)
(into (invoice-payments invoices invoice-amounts))) (:id context))]
(doseq [n (:tempids result)]
(solr/touch-with-ledger n)))
(->graphql {:invoices (d-invoices/get-multi (map :db/id invoices))})))
(def objects