From 829c857122b812a47b7851f7690fc31f80d16e74 Mon Sep 17 00:00:00 2001 From: Bryce Date: Thu, 28 Sep 2023 23:37:23 -0700 Subject: [PATCH] one more tweak. --- src/clj/auto_ap/graphql.clj | 2 - src/clj/auto_ap/graphql/reports.clj | 81 ----------------------------- 2 files changed, 83 deletions(-) delete mode 100644 src/clj/auto_ap/graphql/reports.clj diff --git a/src/clj/auto_ap/graphql.clj b/src/clj/auto_ap/graphql.clj index 559e75a0..7c1c3445 100644 --- a/src/clj/auto_ap/graphql.clj +++ b/src/clj/auto_ap/graphql.clj @@ -13,7 +13,6 @@ [auto-ap.graphql.jobs :as gq-jobs] [auto-ap.graphql.ledger :as gq-ledger] [auto-ap.graphql.plaid :as gq-plaid] - [auto-ap.graphql.reports :as gq-reports] [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] @@ -821,7 +820,6 @@ :search-account gq-accounts/search}) gq-checks/attach gq-ledger/attach - gq-reports/attach gq-plaid/attach gq-import-batches/attach gq-transactions/attach diff --git a/src/clj/auto_ap/graphql/reports.clj b/src/clj/auto_ap/graphql/reports.clj deleted file mode 100644 index 7975db6d..00000000 --- a/src/clj/auto_ap/graphql/reports.clj +++ /dev/null @@ -1,81 +0,0 @@ -(ns auto-ap.graphql.reports - (:require - [amazonica.aws.s3 :as s3] - [auto-ap.datomic :refer [conn]] - [auto-ap.datomic.reports :as r] - [auto-ap.graphql.utils - :refer [<-graphql assert-admin attach-tracing-resolvers result->page]] - [config.core :refer [env]] - [datomic.api :as dc])) - -(defn get-report-page [context args _] - (let [args (assoc args :clients (:clients context)) - [reports reports-count] (r/get-graphql (assoc (<-graphql (:filters args)) - :clients (:clients context)))] - (result->page reports reports-count :reports (:filters args))) - ) - -(defn delete-report [context args _] - (assert-admin (:id context)) - (let [[id-to-delete key] (first (dc/q '[:find ?i ?k - :in $ ?i - :where [?i :report/key ?k]] - (dc/db conn) - (:id args)))] - (when id-to-delete - (s3/delete-object :bucket-name (:data-bucket env) - :key key) - @(dc/transact conn [[:db/retractEntity id-to-delete]])) - {:message (format "deleted %s successfully" key)})) - - - - -(def objects - {:report - {:fields {:url {:type 'String} - :name {:type 'String} - :created {:type :iso_date} - :creator {:type 'String} - :id {:type :id}}} - - :report_page - {:fields {:reports {:type '(list :report)} - :count {:type 'Int} - :total {:type 'Int} - :start {:type 'Int} - :end {:type 'Int}}}}) - -(def queries - {:report_page {:type :report_page - :args {:filters {:type :report_filters}} - :resolve :get-report-page}}) - -(def mutations - {:delete_report {:type :message - :args {:id {:type :id}} - :resolve :mutation/delete-report}}) - -(def input-objects - {:report_filters - {:fields {:start {:type 'Int} - :per_page {:type 'Int} - :sort {:type '(list :sort_item)}}}}) - -(def enums - {}) - -(def resolvers - {:get-report-page get-report-page - :mutation/delete-report delete-report}) - - -(defn attach [schema] - (-> - (merge-with merge schema - {:objects objects - :queries queries - :mutations mutations - :input-objects input-objects - :enums enums}) - (attach-tracing-resolvers resolvers)))