another sql mutation bites the dust.

This commit is contained in:
Bryce Covert
2018-09-03 14:54:18 -07:00
parent fe5d09c02b
commit 2e87b9ddff
4 changed files with 11 additions and 7 deletions

View File

@@ -80,6 +80,10 @@
(<-datomic)
(first)))
(defn update [update]
@(d/transact (d/connect uri) [update])
(get-by-id (:db/id update) ))
(defn get-multi [ids]
(->>
(d/query {:query {:find [[default-read '...]]

View File

@@ -324,7 +324,7 @@
:args {:invoice {:type :edit_invoice}}
:resolve :mutation/edit-invoice}
:void_invoice {:type :invoice
:args {:invoice_id {:type 'Int}}
:args {:invoice_id {:type 'String}}
:resolve :mutation/void-invoice}
:void_payment {:type :payment
:args {:payment_id {:type 'String}}

View File

@@ -64,12 +64,12 @@
(->graphql))))
(defn void-invoice [context {id :invoice_id} value]
(let [invoice (invoices/get-by-id id)
(let [invoice (d-invoices/get-by-id id)
_ (assert-can-see-company (:id context) (:company-id invoice))
updated-invoice (invoices/update {:id id
:total 0
:outstanding-balance 0
:status "voided"})]
updated-invoice (d-invoices/update {:db/id (Long/parseLong id)
:invoice/total 0.0
:invoice/outstanding-balance 0.0
:invoice/status :invoice-status/voided})]
(-> updated-invoice
(->graphql))))

View File

@@ -309,7 +309,7 @@
:venia/queries [{:query/data [:void-invoice
{:invoice-id id}
[:id :total :outstanding-balance :date :invoice-number
[:company [:id :name :locations]]
[:client [:id :name :locations]]
[:vendor [:id :name]]
[:expense_accounts [:amount :id :expense_account_id
:location