minor reorg.
This commit is contained in:
@@ -386,26 +386,10 @@
|
|||||||
node))
|
node))
|
||||||
m))
|
m))
|
||||||
|
|
||||||
(defn get-invoice-page [context args value]
|
|
||||||
(let [args (assoc args :id (:id context))
|
|
||||||
|
|
||||||
invoices (map
|
|
||||||
->graphql
|
|
||||||
(d-invoices/get-graphql (<-graphql (assoc args :id (:id context)))))
|
|
||||||
invoice-count (d-invoices/count-graphql (<-graphql args))]
|
|
||||||
[{:invoices invoices
|
|
||||||
:total invoice-count
|
|
||||||
:count (count invoices)
|
|
||||||
:start (:start args 0)
|
|
||||||
:end (+ (:start args 0) (count invoices))}]))
|
|
||||||
|
|
||||||
|
|
||||||
(defn get-all-invoices [context args value]
|
|
||||||
(assert-admin (:id context))
|
|
||||||
(map
|
|
||||||
->graphql
|
|
||||||
(d-invoices/get-graphql (assoc (<-graphql args)
|
|
||||||
:limit Integer/MAX_VALUE))))
|
|
||||||
|
|
||||||
(defn get-all-payments [context args value]
|
(defn get-all-payments [context args value]
|
||||||
(assert-admin (:id context))
|
(assert-admin (:id context))
|
||||||
@@ -459,8 +443,8 @@
|
|||||||
|
|
||||||
(def schema
|
(def schema
|
||||||
(-> integreat-schema
|
(-> integreat-schema
|
||||||
(attach-resolvers {:get-invoice-page get-invoice-page
|
(attach-resolvers {:get-invoice-page gq-invoices/get-invoice-page
|
||||||
:get-all-invoices get-all-invoices
|
:get-all-invoices gq-invoices/get-all-invoices
|
||||||
:get-all-payments get-all-payments
|
:get-all-payments get-all-payments
|
||||||
:get-payment-page gq-checks/get-payment-page
|
:get-payment-page gq-checks/get-payment-page
|
||||||
:get-transaction-page gq-transactions/get-transaction-page
|
:get-transaction-page gq-transactions/get-transaction-page
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
(ns auto-ap.graphql.invoices
|
(ns auto-ap.graphql.invoices
|
||||||
(:require [auto-ap.graphql.utils :refer [->graphql assert-can-see-company]]
|
(:require [auto-ap.graphql.utils :refer [->graphql <-graphql assert-can-see-company assert-admin]]
|
||||||
|
|
||||||
[auto-ap.datomic.vendors :as d-vendors]
|
[auto-ap.datomic.vendors :as d-vendors]
|
||||||
[auto-ap.datomic.invoices :as d-invoices]
|
[auto-ap.datomic.invoices :as d-invoices]
|
||||||
@@ -10,6 +10,25 @@
|
|||||||
[clj-time.coerce :as coerce]
|
[clj-time.coerce :as coerce]
|
||||||
[clojure.set :as set]))
|
[clojure.set :as set]))
|
||||||
|
|
||||||
|
(defn get-invoice-page [context args value]
|
||||||
|
(let [args (assoc args :id (:id context))
|
||||||
|
invoices (map
|
||||||
|
->graphql
|
||||||
|
(d-invoices/get-graphql (<-graphql (assoc args :id (:id context)))))
|
||||||
|
invoice-count (d-invoices/count-graphql (<-graphql args))]
|
||||||
|
[{:invoices invoices
|
||||||
|
:total invoice-count
|
||||||
|
:count (count invoices)
|
||||||
|
:start (:start args 0)
|
||||||
|
:end (+ (:start args 0) (count invoices))}]))
|
||||||
|
|
||||||
|
(defn get-all-invoices [context args value]
|
||||||
|
(assert-admin (:id context))
|
||||||
|
(map
|
||||||
|
->graphql
|
||||||
|
(d-invoices/get-graphql (assoc (<-graphql args)
|
||||||
|
:limit Integer/MAX_VALUE))))
|
||||||
|
|
||||||
(defn add-invoice [context {{:keys [total invoice_number location client_id vendor_id vendor_name date] :as in} :invoice} value]
|
(defn add-invoice [context {{:keys [total invoice_number location client_id vendor_id vendor_name date] :as in} :invoice} value]
|
||||||
(when (seq (d-invoices/find-conflicting {:invoice/invoice-number invoice_number
|
(when (seq (d-invoices/find-conflicting {:invoice/invoice-number invoice_number
|
||||||
:invoice/vendor (Long/parseLong vendor_id)
|
:invoice/vendor (Long/parseLong vendor_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user