you can change statuses in bulk!

This commit is contained in:
Bryce Covert
2020-12-11 17:47:51 -08:00
parent e2ae7a6d4f
commit 9ee9855169
3 changed files with 26 additions and 19 deletions

View File

@@ -36,10 +36,11 @@
:start (:start args 0)
:end (+ (:start args 0) (count transactions))}))
(defn unapprove-transactions [context args value]
(defn bulk-change-status [context args value]
(let [_ (assert-admin (:id context))
args (assoc args :id (:id context))
ids (some-> (:filters args)
(assoc :id (:id context))
(<-graphql)
(update :approval-status enum->keyword "transaction-approval-status")
(assoc :per-page Integer/MAX_VALUE)
@@ -53,10 +54,10 @@
(audit-transact-batch
(mapv (fn [i]
{:db/id i
:transaction/approval-status :transaction-approval-status/unapproved})
:transaction/approval-status (enum->keyword (:status args) "transaction-approval-status")})
all-ids)
(:id context))
{:message (str "Succesfully unapproved " (count all-ids) " transactions.")}))
{:message (str "Succesfully changed " (count all-ids) " transactions to be " (name (:status args) ) ".")}))
(defn delete-transactions [context args value]