diff --git a/src/clj/auto_ap/graphql/invoices.clj b/src/clj/auto_ap/graphql/invoices.clj index c306a636..78ecb65e 100644 --- a/src/clj/auto_ap/graphql/invoices.clj +++ b/src/clj/auto_ap/graphql/invoices.clj @@ -253,6 +253,17 @@ specific-ids (d-invoices/filter-ids (:ids args))] (into (set ids) specific-ids))) +(defn all-ids-not-locked [all-ids] + (->> all-ids + (d/q '[:find [?i ...] + :in $ [?i ...] + :where + [?i :invoice/client ?c] + [(get-else $ ?c :client/locked-until #inst "2000-01-01") ?lu] + [?i :invoice/date ?d] + [(>= ?d ?lu)]] + (d/db conn)))) + (defn void-invoices [context args _] (let [_ (assert-admin (:id context)) args (assoc args :id (:id context)) @@ -381,16 +392,7 @@ [])] [:reset (:db/id invoice) :invoice/expense-accounts accounts]))) -(defn all-ids-not-locked [all-ids] - (->> all-ids - (d/q '[:find [?i ...] - :in $ [?i ...] - :where - [?i :invoice/client ?c] - [(get-else $ ?c :client/locked-until #inst "2000-01-01") ?lu] - [?i :invoice/date ?d] - [(>= ?d ?lu)]] - (d/db conn)))) + (defn bulk-change-invoices [context args _] (assert-admin (:id context))