Migrates back to datomic on-prem
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
[auto-ap.time :as atime]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clojure.string :as str]
|
||||
[datomic.client.api :as dc]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]))
|
||||
|
||||
(defn tx-rows->changes [history]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
[auto-ap.ssr.utils :refer [html-response]]
|
||||
[bidi.bidi :as bidi]
|
||||
[clojure.string :as str]
|
||||
[datomic.client.api :as dc]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]))
|
||||
|
||||
(defn cannot-overwrite? [vendor]
|
||||
@@ -210,11 +210,11 @@
|
||||
|
||||
(defn vendor-save [{:keys [form-params identity route-params] :as request}]
|
||||
(when-not (cannot-overwrite? (dc/pull (dc/db conn) '[*] (Long/parseLong (:vendor-id route-params))))
|
||||
@(dc/transact conn {:tx-data [(remove-nils
|
||||
(-> (form-data->map form-params)
|
||||
(assoc :db/id (Long/parseLong (:vendor-id route-params)))
|
||||
(update :vendor/legal-entity-1099-type #(some->> % (keyword "legal-entity-1099-type")))
|
||||
(update :vendor/legal-entity-tin-type #(some->> % (keyword "legal-entity-tin-type")))))]}))
|
||||
@(dc/transact conn [(remove-nils
|
||||
(-> (form-data->map form-params)
|
||||
(assoc :db/id (Long/parseLong (:vendor-id route-params)))
|
||||
(update :vendor/legal-entity-1099-type #(some->> % (keyword "legal-entity-1099-type")))
|
||||
(update :vendor/legal-entity-tin-type #(some->> % (keyword "legal-entity-tin-type")))))]))
|
||||
(html-response
|
||||
(table request :flash-id (Long/parseLong (:vendor-id route-params)))))
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
[auto-ap.ssr.components.navbar-dropdown :refer [navbar-dropdown]]
|
||||
[auto-ap.ssr.utils :refer [html-response]]
|
||||
[bidi.bidi :as bidi]
|
||||
[datomic.client.api :as dc]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]))
|
||||
|
||||
(defn dropdown-contents [{:keys [identity]}]
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
[auto-ap.time :as atime]
|
||||
[bidi.bidi :as bidi]
|
||||
[clj-time.coerce :as coerce]
|
||||
[datomic.client.api :as dc]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]
|
||||
[clj-time.core :as time]))
|
||||
|
||||
@@ -110,25 +110,24 @@
|
||||
(let [r (dc/pull (dc/db conn)
|
||||
pull-expr
|
||||
(Long/parseLong transaction-id))
|
||||
similar (->> {:query '[:find ?date ?do ?amt
|
||||
:in $ ?tr
|
||||
:where
|
||||
[(iol-ion.query/recent-date 180) ?start-date]
|
||||
[?tr :transaction/client ?c]
|
||||
[?tr :transaction/recommended-account ?a ]
|
||||
[?tr :transaction/recommended-vendor ?v ]
|
||||
[?t2 :transaction/client ?c]
|
||||
[?t2 :transaction/date ?date]
|
||||
[(>= ?date ?start-date)]
|
||||
[?t2 :transaction/vendor ?v]
|
||||
[?t2 :transaction/accounts ?a2]
|
||||
[?a2 :transaction-account/account ?a]
|
||||
[?t2 :transaction/description-original ?do]
|
||||
[?t2 :transaction/amount ?amt]]
|
||||
:args [(dc/db conn)
|
||||
(Long/parseLong transaction-id)]
|
||||
:limit 5}
|
||||
dc/q
|
||||
similar (->> (dc/q '[:find ?date ?do ?amt
|
||||
:in $ ?tr
|
||||
:where
|
||||
[(iol-ion.query/recent-date 180) ?start-date]
|
||||
[?tr :transaction/client ?c]
|
||||
[?tr :transaction/recommended-account ?a ]
|
||||
[?tr :transaction/recommended-vendor ?v ]
|
||||
[?t2 :transaction/client ?c]
|
||||
[?t2 :transaction/date ?date]
|
||||
[(>= ?date ?start-date)]
|
||||
[?t2 :transaction/vendor ?v]
|
||||
[?t2 :transaction/accounts ?a2]
|
||||
[?a2 :transaction-account/account ?a]
|
||||
[?t2 :transaction/description-original ?do]
|
||||
[?t2 :transaction/amount ?amt]]
|
||||
(dc/db conn)
|
||||
(Long/parseLong transaction-id))
|
||||
(take 5)
|
||||
sort
|
||||
reverse)]
|
||||
(html-response [:div.modal.is-active.wide
|
||||
|
||||
Reference in New Issue
Block a user