Revert "Prep to select more than 1 client"

This reverts commit 085486043f.
This commit is contained in:
Bryce Covert
2021-10-18 06:32:24 -07:00
parent 8ecd34f18c
commit 574023fea0
4 changed files with 323 additions and 312 deletions

View File

@@ -554,7 +554,6 @@
:profit_and_loss {:type :profit_and_loss_report
:args {:client_id {:type :id}
:client_ids {:type '(list :id)}
:periods {:type '(list :date_range)}}
:resolve :get-profit-and-loss}

View File

@@ -183,14 +183,9 @@
(defn get-profit-and-loss [context args value]
(let [client-id (:client_id args)
client-ids (or (some-> client-id vector)
(:client_ids args))
_ (when (not (seq client-ids))
(throw (ex-info "Please select a client." {:validation-error "Please select a client."})))
_ (doseq [client-id client-ids]
(assert-can-see-client (:id context) client-id))
all-ledger-entries (full-ledger-for-client (first client-ids))
lookup-account (build-account-lookup (first client-ids))]
_ (assert-can-see-client (:id context) client-id)
all-ledger-entries (full-ledger-for-client client-id)
lookup-account (build-account-lookup client-id)]
(->graphql
{:periods (reduce (fn [acc {:keys [start end]}]
(conj acc