Makes sales orders link to their deposits

This commit is contained in:
2022-07-04 07:19:14 -07:00
parent 496b0f487c
commit 2d5b8eded4
6 changed files with 146 additions and 70 deletions

View File

@@ -2,7 +2,6 @@
(: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]
@@ -194,34 +193,9 @@
:order_line_item
{:fields {:id {:type :id}
:item_name {:type 'String}
:total {:type :money}
:tax {:type :money}
:category {:type 'String}
:discount {:type :money}}}
:charge
{:fields {:id {:type :id}
:processor {:type :processor}
:type_name {:type 'String}
:total {:type :money}
:tip {:type :money}}}
:sales_order
{:fields {:id {:type :id}
:location {:type 'String}
:external_id {:type 'String}
:total {:type :money}
:tip {:type :money}
:tax {:type :money}
:discount {:type :money}
:service_charge {:type :money}
:returns {:type :money}
:client {:type :client}
:date {:type 'String}
:charges {:type '(list :charge)}
:line_items {:type '(list :order_line_item)}}}
:yodlee_merchant {:fields {:id {:type :id}
:yodlee_id {:type 'String}
:name {:type 'String}}}
@@ -291,13 +265,7 @@
:sales_order_page {:fields {:sales_orders {:type '(list :sales_order)}
:count {:type 'Int}
:total {:type 'Int}
:start {:type 'Int}
:end {:type 'Int}
:sales_order_total {:type :money}
:sales_order_tax {:type :money}}}
:vendor_page {:fields {:vendors {:type '(list :vendor)}
:count {:type 'Int}
@@ -386,11 +354,7 @@
: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 {}
@@ -413,16 +377,7 @@
:sales_order_page {:type :sales_order_page
:args {:client_id {:type :id}
:date_range {:type :date_range}
:total_lte {:type :money}
:total_gte {:type :money}
:processor {:type :processor}
:start {:type 'Int}
:per_page {:type 'Int}
:sort {:type '(list :sort_item)}}
:resolve :get-sales-order-page}
:vendor {:type :vendor_page
:args {:name_like {:type 'String}
:start {:type 'Int}
@@ -636,11 +591,7 @@
(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))
@@ -812,10 +763,8 @@
(-> integreat-schema
(attach-resolvers {
:get-yodlee-provider-account-page gq-yodlee2/get-yodlee-provider-account-page
:get-all-sales-orders get-all-sales-orders
:get-accounts gq-accounts/get-graphql
:get-all-accounts gq-accounts/get-all-graphql
:get-sales-order-page gq-sales-orders/get-sales-orders-page
:get-transaction-rule-page gq-transaction-rules/get-transaction-rule-page
:get-transaction-rule-matches gq-transaction-rules/get-transaction-rule-matches
:get-expense-account-stats get-expense-account-stats
@@ -847,6 +796,7 @@
gq-expected-deposit/attach
gq-invoices/attach
gq-clients/attach
gq-sales-orders/attach
schema/compile))