almost allow completely adding new clients and sorting and filtering.
This commit is contained in:
@@ -11,9 +11,12 @@
|
||||
(map (fn [c]
|
||||
(update c :client/bank-accounts
|
||||
(fn [bas]
|
||||
(map (fn [ba]
|
||||
(update ba :bank-account/type :db/ident ))
|
||||
bas)))))))
|
||||
(map (fn [i ba]
|
||||
(-> ba
|
||||
(update :bank-account/type :db/ident )
|
||||
(update :bank-account/sort-order (fn [so] (or so i)))))
|
||||
(range) bas)))))
|
||||
))
|
||||
(defn get-by-id [id]
|
||||
(->>
|
||||
(d/query (-> {:query {:find ['(pull ?e [*])]
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
:auto-ap/add-import-status-existing-invoices {:txes-fn 'auto-ap.datomic.migrate.invoice-converter/add-import-status-existing-invoices :requires [:auto-ap/add-import-status]}
|
||||
:auto-ap/fix-check-numbers {:txes-fn 'auto-ap.datomic.migrate.check-numbers/fix-check-numbers :requires [:auto-ap/add-import-status-existing-invoices]}
|
||||
:auto-ap/add-new-vendors {:txes-fn 'auto-ap.datomic.migrate.add-new-vendors/add-new-vendors :requires [:auto-ap/fix-check-numbers]}
|
||||
:auto-ap/add-account-visibility-fields {:txes-fn 'auto-ap.datomic.migrate.account-sorting/add-account-visibility-fields :requires [:auto-ap/add-new-vendors]}
|
||||
:auto-ap/make-every-account-visible {:txes-fn 'auto-ap.datomic.migrate.account-sorting/make-every-account-visible :requires [:auto-ap/add-account-visibility-fields]}
|
||||
|
||||
}]
|
||||
(println "Conforming database...")
|
||||
(println (c/ensure-conforms conn norms-map))
|
||||
|
||||
27
src/clj/auto_ap/datomic/migrate/account_sorting.clj
Normal file
27
src/clj/auto_ap/datomic/migrate/account_sorting.clj
Normal file
@@ -0,0 +1,27 @@
|
||||
(ns auto-ap.datomic.migrate.account-sorting
|
||||
(:require [datomic.api :as d]))
|
||||
|
||||
|
||||
(defn add-account-visibility-fields [conn]
|
||||
[[
|
||||
{:db/ident :bank-account/visible
|
||||
:db/valueType :db.type/boolean
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "Whether this bank account is visible"}
|
||||
{:db/ident :bank-account/sort-order
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "The sort order of the bank account"}]])
|
||||
|
||||
(defn make-every-account-visible [conn]
|
||||
(let [all-account-ids (d/query
|
||||
{:query {:find ['?e]
|
||||
:in ['$]
|
||||
:where ['[?e :bank-account/code]]}
|
||||
:args [(d/db conn)]}
|
||||
)]
|
||||
[(map
|
||||
(fn [[account-id]]
|
||||
{:db/id account-id :bank-account/visible true}
|
||||
)
|
||||
all-account-ids)]))
|
||||
Reference in New Issue
Block a user