(cloud) experimental approach to ensure the ledgers do not get out of sync
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
(ns auto-ap.routes.invoices
|
||||
(:require
|
||||
[amazonica.aws.s3 :as s3]
|
||||
[auto-ap.datomic :refer [conn remove-nils uri]]
|
||||
[iol-ion.tx :refer [propose-invoice]]
|
||||
[auto-ap.datomic :refer [audit-transact conn remove-nils]]
|
||||
[auto-ap.datomic.accounts :as a]
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.invoices :as d-invoices]
|
||||
@@ -10,7 +9,6 @@
|
||||
[auto-ap.graphql.utils :refer [assert-admin assert-can-see-client]]
|
||||
[auto-ap.import.manual :as manual]
|
||||
[auto-ap.import.manual.common :as c]
|
||||
[auto-ap.ledger :refer [transact-with-ledger]]
|
||||
[auto-ap.parse :as parse]
|
||||
[auto-ap.routes.utils :refer [wrap-secure]]
|
||||
[auto-ap.utils :refer [by]]
|
||||
@@ -22,6 +20,7 @@
|
||||
[config.core :refer [env]]
|
||||
[datomic.client.api :as dc]
|
||||
[digest]
|
||||
[iol-ion.tx :refer [propose-invoice]]
|
||||
[ring.middleware.json :refer [wrap-json-response]]
|
||||
[unilog.context :as lc])
|
||||
(:import
|
||||
@@ -278,7 +277,7 @@
|
||||
(mapv (fn [i] `(propose-invoice ~i))))]
|
||||
|
||||
(log/info "creating invoice" potential-invoices)
|
||||
(let [tx (transact-with-ledger potential-invoices user)]
|
||||
(let [tx (audit-transact potential-invoices user)]
|
||||
(when-not (seq (dc/q '[:find ?i
|
||||
:in $ [?i ...]
|
||||
:where [?i :invoice/invoice-number]]
|
||||
@@ -395,7 +394,7 @@
|
||||
conj
|
||||
[]
|
||||
rows)]
|
||||
(transact-with-ledger txes nil)))
|
||||
(audit-transact txes nil)))
|
||||
|
||||
(defn batch-upload-transactions [{{:keys [data]} :edn-params user :identity}]
|
||||
(assert-admin user)
|
||||
@@ -479,7 +478,7 @@
|
||||
(not= "Cash" (:check %))))
|
||||
(map :vendor-name)
|
||||
set)
|
||||
_ (transact-with-ledger (invoice-rows->transaction (:new grouped-rows)
|
||||
_ (audit-transact (invoice-rows->transaction (:new grouped-rows)
|
||||
user)
|
||||
user)]
|
||||
{:status 200
|
||||
|
||||
Reference in New Issue
Block a user