everything is audited.
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
(ns auto-ap.routes.exports
|
||||
(:require
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.vendors :as d-vendors]
|
||||
[auto-ap.datomic.ledger :as d-ledger]
|
||||
[auto-ap.datomic.transactions :as d-transactions]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[auto-ap.parse :as parse]
|
||||
[auto-ap.graphql :as graphql]
|
||||
[auto-ap.graphql.utils :refer [<-graphql ->graphql assert-admin]]
|
||||
[auto-ap.routes.utils :refer [wrap-secure]]
|
||||
[clj-time.coerce :refer [to-date]]
|
||||
[ring.middleware.json :refer [wrap-json-response]]
|
||||
[compojure.core :refer [GET POST context defroutes wrap-routes]]
|
||||
[clojure.string :as str]
|
||||
[venia.core :as venia]))
|
||||
[auto-ap.datomic.clients :as d-clients]
|
||||
[auto-ap.datomic.vendors :as d-vendors]
|
||||
[auto-ap.datomic.ledger :as d-ledger]
|
||||
[auto-ap.datomic.transactions :as d-transactions]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[auto-ap.parse :as parse]
|
||||
[auto-ap.graphql :as graphql]
|
||||
[auto-ap.graphql.utils :refer [<-graphql ->graphql assert-admin]]
|
||||
[auto-ap.routes.utils :refer [wrap-secure]]
|
||||
[clj-time.coerce :refer [to-date]]
|
||||
[ring.middleware.json :refer [wrap-json-response]]
|
||||
[compojure.core :refer [GET POST context defroutes wrap-routes]]
|
||||
[clojure.string :as str]
|
||||
[venia.core :as venia]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(defroutes routes
|
||||
(wrap-routes
|
||||
@@ -48,6 +49,41 @@
|
||||
payments (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))]
|
||||
(list (:all-payments (:data payments)))))
|
||||
|
||||
(GET "/sales/export" {:keys [query-params identity]}
|
||||
(assert-admin identity)
|
||||
(let [query [[:all_sales_orders
|
||||
(cond-> {:client-code (query-params "client-code")}
|
||||
(query-params "after") (assoc :date-range {:start (query-params "after")
|
||||
:end nil}))
|
||||
[:id
|
||||
:location
|
||||
:external_id
|
||||
:total
|
||||
:tip
|
||||
:tax
|
||||
:date
|
||||
[:charges [:type_name :total :tip]]
|
||||
[:line_items [:item_name :total :tax]]
|
||||
[:client [:id :name :code]]]]]
|
||||
payments (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))]
|
||||
(seq (:all-sales-orders (:data payments)))))
|
||||
|
||||
(GET "/expected-deposit/export" {:keys [query-params identity]}
|
||||
(assert-admin identity)
|
||||
(let [query [[:all_expected_deposits
|
||||
(cond-> {:client-code (query-params "client-code")}
|
||||
(query-params "after") (assoc :date-range {:start (query-params "after")
|
||||
:end nil}))
|
||||
[:id
|
||||
[:client [:id :name :code]]
|
||||
:location
|
||||
:external_id
|
||||
:total
|
||||
:fee
|
||||
:date]]]
|
||||
payments (graphql/query identity (venia/graphql-query {:venia/queries (->graphql query)}))]
|
||||
(seq (:all-expected-deposits (:data payments)))))
|
||||
|
||||
(GET "/clients/export" {:keys [query-params identity]}
|
||||
(assert-admin identity)
|
||||
(map <-graphql (d-clients/get-all)))
|
||||
|
||||
Reference in New Issue
Block a user