improvements for payment finding

This commit is contained in:
2021-04-27 21:46:45 -07:00
parent ec236ae979
commit 4c764ed927
6 changed files with 45 additions and 10 deletions

View File

@@ -8,12 +8,14 @@
[auto-ap.graphql.utils :refer [->graphql <-graphql assert-admin]]
[auto-ap.routes.utils :refer [wrap-secure]]
[clojure.tools.logging :as log]
[auto-ap.logging :refer [error-event info-event warn-event]]
[clj-time.coerce :as coerce :refer [to-date]]
[clj-time.core :as time]
[compojure.core :refer [context defroutes GET wrap-routes]]
[datomic.api :as d]
[ring.middleware.json :refer [wrap-json-response]]
[venia.core :as venia]))
[venia.core :as venia]
[yang.time :refer [time-it]]))
(defroutes routes
(wrap-routes
@@ -125,14 +127,19 @@
(assert-admin identity)
(map <-graphql (d-vendors/get-graphql {})))
(GET "/ledger/export" {:keys [query-params identity]}
(log/info "exporting for " (query-params "client-code"))
(assert-admin identity)
(transduce (comp
(map #(update % :journal-entry/date to-date))
(map <-graphql))
conj
(list)
(first (d-ledger/get-graphql {:count Integer/MAX_VALUE
:client-code (query-params "client-code")}))))
(let [[result time] (time-it (transduce (comp
(map #(update % :journal-entry/date to-date))
(map <-graphql))
conj
(list)
(first (d-ledger/get-graphql {:count Integer/MAX_VALUE
:client-code (query-params "client-code")}))))]
(info-event "Export completed"
{:time (:time time)
:errors (seq (:errors result))})
result))
(GET "/accounts/export" {:keys [query-params identity]}
(assert-admin identity)