making cloud runnable again.

This commit is contained in:
2022-09-28 09:03:28 -07:00
parent d02fba2b44
commit 65ecee7014
11 changed files with 70 additions and 69 deletions

View File

@@ -1,8 +1,6 @@
(ns auto-ap.graphql.invoices
(:require
[auto-ap.datomic
:refer [conn remove-nils upsert-entity]]
[auto-ap.ledger :refer [transact-with-ledger]]
[auto-ap.datomic :refer [conn random-tempid remove-nils upsert-entity]]
[auto-ap.datomic.clients :as d-clients]
[auto-ap.datomic.invoices :as d-invoices]
[auto-ap.datomic.vendors :as d-vendors]
@@ -92,10 +90,10 @@
(throw (ex-info (str "Invoice '" invoice_number "' already exists.") {:invoice-number invoice_number :validation-error (str "Invoice '" invoice_number "' already exists.")}))))
(defn expense-account->entity [{:keys [id account_id amount location]}]
(remove-nils #:invoice-expense-account {:amount amount
:db/id id
:account account_id
:location location}))
#:invoice-expense-account {:amount amount
:db/id (or id (random-tempid))
:account account_id
:location location})
(defn add-invoice-transaction [{:keys [total invoice_number scheduled_payment client_id vendor_id date due expense_accounts]}]
(let [vendor (d-vendors/get-by-id vendor_id)
@@ -109,6 +107,7 @@
due))
_ (when-not (:db/id account)
(throw (ex-info (str "Vendor '" (:vendor/name vendor) "' does not have a default expense acount.") {:vendor-id vendor_id})))]
`(upsert-entity ~{:db/id "invoice"
:invoice/invoice-number invoice_number
:invoice/client client_id