everything is audited.

This commit is contained in:
Bryce Covert
2020-09-04 19:53:39 -07:00
parent 3d0f079de2
commit 11f61464f5
15 changed files with 297 additions and 131 deletions

View File

@@ -1,43 +1,35 @@
(ns auto-ap.graphql
(:require
[com.walmartlabs.lacinia.util :refer [attach-resolvers]]
[com.walmartlabs.lacinia.schema :as schema]
[com.walmartlabs.lacinia :refer [execute]]
[com.walmartlabs.lacinia.executor :as executor]
[com.walmartlabs.lacinia.resolve :as resolve]
[buddy.auth :refer [throw-unauthorized]]
[auto-ap.utils :refer [by]]
[auto-ap.logging :refer [info-event warn-event error-event]]
[auto-ap.graphql.utils :refer [assert-admin can-see-client? assert-can-see-client]]
[auto-ap.datomic :refer [uri merge-query]]
[datomic.api :as d]
[clj-time.coerce :as coerce]
[clj-time.core :as t]
[auto-ap.datomic.clients :as d-clients]
[auto-ap.datomic.checks :as d-checks]
[auto-ap.datomic.users :as d-users]
[auto-ap.datomic.invoices :as d-invoices]
[auto-ap.datomic.vendors :as d-vendors]
[auto-ap.graphql.users :as gq-users]
[auto-ap.graphql.yodlee-merchants :as ym]
[auto-ap.graphql.ledger :as gq-ledger]
[auto-ap.graphql.sales-orders :as gq-sales-orders]
[auto-ap.graphql.accounts :as gq-accounts]
[auto-ap.graphql.clients :as gq-clients]
[auto-ap.graphql.vendors :as gq-vendors]
[auto-ap.graphql.checks :as gq-checks]
[auto-ap.graphql.invoices :as gq-invoices]
[auto-ap.graphql.transactions :as gq-transactions]
[auto-ap.graphql.transaction-rules :as gq-transaction-rules]
[auto-ap.time :as time]
[clojure.walk :as walk]
[clojure.string :as str]
[clojure.tools.logging :as log]
[yang.time :refer [time-it]]
[unilog.context :as lc])
(:import
(clojure.lang IPersistentMap)))
(:require [auto-ap.datomic :refer [merge-query uri]]
[auto-ap.datomic.checks :as d-checks]
[auto-ap.datomic.sales-orders :as d-sales-orders]
[auto-ap.datomic.users :as d-users]
[auto-ap.graphql.accounts :as gq-accounts]
[auto-ap.graphql.checks :as gq-checks]
[auto-ap.graphql.clients :as gq-clients]
[auto-ap.graphql.expected-deposit :as gq-expected-deposit]
[auto-ap.graphql.invoices :as gq-invoices]
[auto-ap.graphql.ledger :as gq-ledger]
[auto-ap.graphql.sales-orders :as gq-sales-orders]
[auto-ap.graphql.transaction-rules :as gq-transaction-rules]
[auto-ap.graphql.transactions :as gq-transactions]
[auto-ap.graphql.users :as gq-users]
[auto-ap.graphql.utils :refer [assert-admin assert-can-see-client]]
[auto-ap.graphql.vendors :as gq-vendors]
[auto-ap.graphql.yodlee-merchants :as ym]
[auto-ap.logging :refer [error-event info-event warn-event]]
[auto-ap.time :as time]
[clj-time.coerce :as coerce]
[clj-time.core :as t]
[clojure.string :as str]
[clojure.tools.logging :as log]
[clojure.walk :as walk]
[com.walmartlabs.lacinia :refer [execute]]
[com.walmartlabs.lacinia.schema :as schema]
[com.walmartlabs.lacinia.util :refer [attach-resolvers]]
[datomic.api :as d]
[unilog.context :as lc]
[yang.time :refer [time-it]])
(:import clojure.lang.IPersistentMap))
(def integreat-schema
{
@@ -221,6 +213,15 @@
:charges {:type '(list :charge)}
:line_items {:type '(list :order_line_item)}}}
:expected_deposit
{:fields {:id {:type :id}
:location {:type 'String}
:external_id {:type 'String}
:total {:type :money}
:fee {:type :money}
:client {:type :client}
:date {:type 'String}}}
:check {:fields {:id {:type :id}
:type {:type 'String}
:amount {:type 'String}
@@ -496,6 +497,17 @@
:statuses {:type '(list String)}}
:resolve :get-all-payments}
:all_expected_deposits {:type '(list :expected_deposit)
:args {:client_id {:type :id}
:client_code {:type 'String}}
:resolve :get-all-expected-deposits}
:all_sales_orders {:type '(list :sales_order)
:args {:client_id {:type :id}
:date_range {:type :date_range}
:client_code {:type 'String}}
:resolve :get-all-sales-orders}
:yodlee_merchants {:type '(list :yodlee_merchant)
:args {}
:resolve :get-yodlee-merchants}
@@ -927,6 +939,12 @@
->graphql
(first (d-checks/get-graphql (assoc (<-graphql args) :count Integer/MAX_VALUE)))))
(defn get-all-sales-orders [context args value]
(assert-admin (:id context))
(map
->graphql
(first (d-sales-orders/get-graphql (assoc (<-graphql args) :count Integer/MAX_VALUE)))))
(defn get-user [context args value]
(assert-admin (:id context))
@@ -1106,6 +1124,8 @@
(attach-resolvers {:get-invoice-page gq-invoices/get-invoice-page
:get-all-invoices gq-invoices/get-all-invoices
:get-all-payments get-all-payments
:get-all-expected-deposits gq-expected-deposit/get-all-expected-deposits
:get-all-sales-orders get-all-sales-orders
:get-payment-page gq-checks/get-payment-page
:get-potential-payments gq-checks/get-potential-payments
:get-accounts gq-accounts/get-accounts