making cloud runnable again.
This commit is contained in:
@@ -4,16 +4,16 @@
|
||||
[auto-ap.graphql.utils :refer [assert-admin cleanse-query]]
|
||||
[auto-ap.graphql.vendors :refer [partial-match-first]]
|
||||
[com.walmartlabs.lacinia.util :refer [attach-resolvers]]
|
||||
[datomic.api :as d]
|
||||
[datomic.client.api :as dc]
|
||||
[auto-ap.graphql.utils :refer [attach-tracing-resolvers]]))
|
||||
|
||||
(defn search [context args _]
|
||||
(assert-admin (:id context))
|
||||
(let [search-query (cleanse-query (:query args))
|
||||
data (d/q '[:find ?n ?i ?s
|
||||
data (dc/q '[:find ?n ?i ?s
|
||||
:in $ ?q
|
||||
:where [(fulltext $ :ezcater-caterer/search-terms ?q) [[?i ?n _ ?s]]]]
|
||||
(d/db conn)
|
||||
(dc/db conn)
|
||||
search-query)]
|
||||
(->> data
|
||||
(sort-by (comp - last))
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user