fixes more background jobs.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
(ns auto-ap.import.plaid
|
(ns auto-ap.import.plaid
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.datomic :refer [conn]]
|
[auto-ap.datomic :refer [conn random-tempid]]
|
||||||
[auto-ap.import.common :refer [wrap-integration]]
|
[auto-ap.import.common :refer [wrap-integration]]
|
||||||
[auto-ap.import.transactions :as t]
|
[auto-ap.import.transactions :as t]
|
||||||
[auto-ap.plaid.core :as p]
|
[auto-ap.plaid.core :as p]
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
(defn plaid->transaction [t]
|
(defn plaid->transaction [t]
|
||||||
#:transaction {:description-original (:name t)
|
#:transaction {:description-original (:name t)
|
||||||
:raw-id (:transaction_id t)
|
:raw-id (:transaction_id t)
|
||||||
|
:db/id (random-tempid)
|
||||||
:id #_{:clj-kondo/ignore [:unresolved-var]}
|
:id #_{:clj-kondo/ignore [:unresolved-var]}
|
||||||
(di/sha-256 (:transaction_id t))
|
(di/sha-256 (:transaction_id t))
|
||||||
:amount (if (= "credit" (:type (:account t)))
|
:amount (if (= "credit" (:type (:account t)))
|
||||||
|
|||||||
@@ -6,26 +6,28 @@
|
|||||||
[datomic.api :as dc]))
|
[datomic.api :as dc]))
|
||||||
|
|
||||||
(defn refresh-vendor-usages []
|
(defn refresh-vendor-usages []
|
||||||
@(dc/transact conn (->> (dc/q '[:find ?v ?c (count ?e)
|
@(dc/transact-async
|
||||||
:in $
|
conn
|
||||||
:where
|
(->> (dc/q '[:find ?v ?c (count ?e)
|
||||||
[?v :vendor/name]
|
:in $
|
||||||
(or-join [?v ?c ?e]
|
:where
|
||||||
(and
|
[?v :vendor/name]
|
||||||
[?e :invoice/vendor ?v]
|
(or-join [?v ?c ?e]
|
||||||
[?e :invoice/client ?c])
|
(and
|
||||||
(and
|
[?e :invoice/vendor ?v]
|
||||||
[?e :transaction/vendor ?v]
|
[?e :invoice/client ?c])
|
||||||
[?e :transaction/client ?c])
|
(and
|
||||||
(and
|
[?e :transaction/vendor ?v]
|
||||||
[?e :journal-entry/vendor ?v]
|
[?e :transaction/client ?c])
|
||||||
[?e :journal-entry/client ?c]))]
|
(and
|
||||||
(dc/db conn))
|
[?e :journal-entry/vendor ?v]
|
||||||
(map (fn [[v c cnt]]
|
[?e :journal-entry/client ?c]))]
|
||||||
#:vendor-usage {:vendor v
|
(dc/db conn))
|
||||||
:client c
|
(map (fn [[v c cnt]]
|
||||||
:key (str v "-" c)
|
#:vendor-usage {:vendor v
|
||||||
:count cnt})))))
|
:client c
|
||||||
|
:key (str v "-" c)
|
||||||
|
:count cnt})))))
|
||||||
|
|
||||||
(defn -main [& _]
|
(defn -main [& _]
|
||||||
(execute "vendor-usages" refresh-vendor-usages))
|
(execute "vendor-usages" refresh-vendor-usages))
|
||||||
|
|||||||
Reference in New Issue
Block a user