no need for transact-with-ledger.

This commit is contained in:
2023-04-03 09:04:33 -07:00
parent 68e809d8fb
commit 6622aae589
12 changed files with 213 additions and 249 deletions

View File

@@ -2,7 +2,7 @@
(:require
[amazonica.aws.s3 :as s3]
[auto-ap.datomic :refer [conn pull-attr random-tempid]]
[auto-ap.ledger :as l :refer [transact-with-ledger]]
[auto-ap.ledger :as l ]
[auto-ap.server]
[auto-ap.square.core :as square]
[auto-ap.square.core2 :as square2]
@@ -68,48 +68,6 @@
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn mark-until-date [client end]
(doseq [p (->>
(dc/q {:query {:find '[?e]
:in '[$ ?client ?end ]
:where [
'[?e :invoice/client ?c]
'[?c :client/code ?client]
'[?e :invoice/date ?d ]
'[(<= ?d ?end) ]]}
:args [(dc/db conn)
client
(c/to-date end)]})
(mapv first)
(mapv (fn [i]
{:db/id i
:invoice/exclude-from-ledger true}))
(partition-all 100))]
(transact-with-ledger p {:user/name "mark-until-date" :user/role "admin"})
(println "process 100"))
(doseq [p (->>
(dc/q {:query {:find '[?e]
:in '[$ ?client ?end ]
:where [
'[?e :transaction/client ?c]
'[?c :client/code ?client]
'[?e :transaction/date ?d ]
'[(<= ?d ?end) ]]}
:args [(dc/db conn)
client
(c/to-date end)]})
(mapv first)
(mapv (fn [i]
{:db/id i
:transaction/approval-status :transaction-approval-status/excluded}))
(partition-all 100))]
(transact-with-ledger p {:user/name "mark-until-date" :user/role "admin"})
(println "process 100")))
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn load-accounts [conn]
(let [[header & rows] (-> "master-account-list.csv" (io/resource) io/input-stream (BOMInputStream.) (io/reader) csv/read-csv)
@@ -443,6 +401,9 @@
(mu/start-publisher! {:type :dev})
(mount.core/start (mount.core/only #{#'auto-ap.datomic/conn #'auto-ap.datomic/client})))
(defn start-search []
(mount.core/start (mount.core/only #{#'auto-ap.graphql.vendors/indexer #'auto-ap.graphql.accounts/indexer})))
(defn restart-db []
#_(require 'datomic.dev-local)
#_(datomic.dev-local/release-db {:system "dev" :db-name "prod-migration"})