(cloud) tweaks for datomic cloud.
This commit is contained in:
@@ -620,13 +620,6 @@
|
||||
(->graphql users)))
|
||||
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn categorize [x]
|
||||
(cond (<= x 0) :due
|
||||
(<= x 30 ) :due-30
|
||||
(<= x 60 ) :due-60
|
||||
:else :due-later))
|
||||
|
||||
|
||||
(defn get-expense-account-stats [_ {:keys [client_id] } _]
|
||||
(let [result (cond-> {:query {:find ['?account '?account-name '(sum ?amount)]
|
||||
@@ -663,7 +656,15 @@
|
||||
'[?i :invoice/due ?date]
|
||||
'[(.toInstant ^java.util.Date ?date) ?d2]
|
||||
'[(.between java.time.temporal.ChronoUnit/DAYS (java.time.Instant/now) ?d2 ) ?d3]
|
||||
'[(auto-ap.graphql/categorize ?d3) ?name]]}})
|
||||
'(or-join [?d3 ?name]
|
||||
(and [(<= ?c 0)]
|
||||
[(ground :due) ?name])
|
||||
(and [(<= ?c 30)]
|
||||
[(ground :due-30) ?name])
|
||||
(and [(<= ?c 60)]
|
||||
[(ground :due-30) ?name])
|
||||
(and [(> ?c 60)]
|
||||
[(ground :due-later) ?name]))]}})
|
||||
|
||||
true (dc/q))
|
||||
result (group-by first result)]
|
||||
|
||||
@@ -45,12 +45,12 @@
|
||||
(or (pull-attr (dc/db conn) :saved-query/guid [:saved-query/lookup-key lookup-key])
|
||||
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
|
||||
:saved-query/lookup-key lookup-key})])
|
||||
(dc/transact conn {:tx-data [`(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
|
||||
:saved-query/lookup-key lookup-key})]})
|
||||
(s3/put-object :bucket-name (:data-bucket env)
|
||||
:key (str "queries/" guid)
|
||||
:input-stream (io/make-input-stream (.getBytes body) {})
|
||||
|
||||
Reference in New Issue
Block a user