Now you can add manual checks.
This commit is contained in:
@@ -4,8 +4,10 @@
|
||||
[com.walmartlabs.lacinia :refer [execute]]
|
||||
[com.walmartlabs.lacinia.executor :as executor]
|
||||
[com.walmartlabs.lacinia.resolve :as resolve]
|
||||
[auto-ap.db.invoices-checks :as invoices-checks]
|
||||
[auto-ap.db.checks :as checks]
|
||||
[auto-ap.db.vendors :as vendors]
|
||||
[auto-ap.db.invoices :as invoices]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[auto-ap.db.companies :as companies]
|
||||
[auto-ap.time :refer [parse normal-date]]))
|
||||
@@ -39,6 +41,26 @@
|
||||
:start (:start args 0)
|
||||
:end (+ (:start args 0) (count checks))}] extra-context)))
|
||||
|
||||
(defn add-handwritten-check [context args value]
|
||||
(let [invoice (invoices/get-by-id (:invoice_id args))
|
||||
check (checks/insert! {:s3-uuid nil
|
||||
:s3-key nil
|
||||
:s3-url nil
|
||||
:check-number (:check_number args)
|
||||
:amount (:amount args)
|
||||
:bank-account-id (:bank_account_id args)
|
||||
:vendor-id (:vendor-id invoice)
|
||||
:company-id (:company-id invoice)
|
||||
:invoices [(:invoice_id args)]})]
|
||||
|
||||
(invoices-checks/insert-multi! [{:invoice-id (:invoice_id args)
|
||||
:check-id (:id check)
|
||||
:amount (:amount args)}])
|
||||
(invoices/apply-payment (:invoice_id args) (:amount args))
|
||||
(->graphql
|
||||
{:s3-url nil
|
||||
:invoices [(invoices/get-by-id (:invoice_id args))]})))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user