Lots of fixes for cloud.

This commit is contained in:
2023-03-28 09:40:45 -07:00
parent 3a126e0b23
commit 5df4033ac0
6 changed files with 20 additions and 19 deletions

View File

@@ -796,7 +796,7 @@
:account-for-vendor gq-accounts/default-for-vendor
:get-user get-user
:mutation/delete-transaction-rule gq-transaction-rules/delete-transaction-rule
:mutation/edit-user gq-users/edit-user
:mutation/edit-user gq-users/edit-user
:mutation/upsert-transaction-rule gq-transaction-rules/upsert-transaction-rule
:test-transaction-rule gq-transaction-rules/test-transaction-rule
:run-transaction-rule gq-transaction-rules/run-transaction-rule

View File

@@ -2,7 +2,6 @@
(:require
[auto-ap.datomic :refer [audit-transact conn]]
[auto-ap.datomic.accounts :as d-accounts]
[iol-ion.tx :refer [upsert-entity]]
[auto-ap.graphql.utils
:refer [->graphql
<-graphql
@@ -15,6 +14,7 @@
[auto-ap.search :as search]
[auto-ap.utils :refer [heartbeat]]
[datomic.client.api :as dc]
[iol-ion.tx :refer [random-tempid upsert-entity]]
[mount.core :as mount]
[yang.scheduler :as scheduler]))
@@ -62,7 +62,7 @@
:account/code (str numeric-code)
:account/client-overrides (mapv
(fn [client-override]
{:db/id (:id client-override)
{:db/id (or (:id client-override) (random-tempid))
:account-client-override/client (:client-id client-override)
:account-client-override/name (:name client-override)
:account-client-override/search-terms (:name client-override)})

View File

@@ -1,11 +1,13 @@
(ns auto-ap.graphql.ezcater
(:require
[auto-ap.datomic :refer [conn]]
[auto-ap.graphql.utils :refer [assert-admin cleanse-query]]
[auto-ap.graphql.utils
:refer [assert-admin attach-tracing-resolvers cleanse-query]]
[auto-ap.search :as search]
[com.walmartlabs.lacinia.util :refer [attach-resolvers]]
[auto-ap.utils :refer [heartbeat]]
[datomic.client.api :as dc]
[auto-ap.graphql.utils :refer [attach-tracing-resolvers]]))
[mount.core :as mount]
[yang.scheduler :as scheduler]))
(defn search [context args _]
(assert-admin (:id context))
@@ -26,6 +28,10 @@
:text (:ezcater-caterer/search-terms result)})
"ezcater-caterer"))
(mount/defstate indexer
:start (scheduler/every (* 5 60 1000) (heartbeat rebuild-search-index "rebuild-search-index"))
:stop (scheduler/stop indexer))
(def objects
{:ezcater_caterer {:fields {:name {:type 'String}
:id {:type :id}}}})

View File

@@ -77,7 +77,7 @@
rule-id (if id
id
"transaction-rule")
transaction [`(upsert-entity ~#:transaction-rule {:db/id rule-id
transaction [`(upsert-entity ~#:transaction-rule {:db/id (or rule-id (random-tempid))
:description description
:note note
:client client_id

View File

@@ -1,8 +1,7 @@
(ns auto-ap.routes.queries
(:require
[amazonica.aws.s3 :as s3]
[auto-ap.datomic :refer [conn pull-attr]]
[iol-ion.tx :refer [upsert-entity]]
[auto-ap.datomic :refer [conn pull-attr pull-id]]
[auto-ap.graphql.utils :refer [assert-admin]]
[clojure.data.csv :as csv]
[clojure.edn :as edn]
@@ -12,7 +11,7 @@
[com.unbounce.dogstatsd.core :as statsd]
[config.core :refer [env]]
[datomic.client.api :as dc]
[iol-ion.tx :refer [random-tempid upsert-entity]]
[ring.middleware.json :refer [wrap-json-response]]
[ring.util.request :refer [body-string]]
[unilog.context :as lc])
@@ -41,11 +40,13 @@
(defn put-query [guid body note & [lookup-key client]]
(let [guid (if lookup-key
(let [id (pull-id (dc/db conn) [:saved-query/lookup-key lookup-key])
guid (if lookup-key
(or (pull-attr (dc/db conn) :saved-query/guid [:saved-query/lookup-key lookup-key])
guid)
guid)]
(dc/transact conn [`(upsert-entity ~{:saved-query/guid guid
(dc/transact conn [`(upsert-entity ~{:db/id (or id (random-tempid))
:saved-query/guid guid
:saved-query/description note
:saved-query/key (str "queries/" guid)
:saved-query/client client

View File

@@ -1,12 +1,5 @@
or-join syntax changed?
(probably fixed) regex no longer supported as argument for query. Check vendor datomic for how to do it right.
it looks like there are a bbunch of orrphaned customizations for accounts, breaking indexes
ezcater graphql needs search index too
make sure that temporary ids are set on all new things when using upsert-entity
Wrap tests around every api call
upsertentity Look at how address works on client save. There's agood chance that we should make saving a rel with only a temp id just resolve it to null
upsertledger - matching transaction rule might not assign an account. Other things might not assign accounts. This is an assertion that is commented out. Determine consequence of disabling
Search for all usages of :reset or :pay or dollars=
Fix searching
* indexing should happen more regularly, and just look for changes since last time it was run
@@ -39,3 +32,4 @@ Future improvements:
Make reports just be based on running-balances
get rid of account-groups
move to solr
upsertentity Look at how address works on client save. There's agood chance that we should make saving a rel with only a temp id just resolve it to null