making it loadable.
This commit is contained in:
@@ -111,7 +111,6 @@
|
||||
:db/doc "A client's computer-friendly name"}
|
||||
{:db/ident :client/signature-file
|
||||
:db/valueType :db.type/string
|
||||
:db/unique :db.unique/identity
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "A check signature image"}
|
||||
|
||||
@@ -536,7 +535,7 @@
|
||||
:code (if (seq code) code nil)
|
||||
:email email
|
||||
:default-expense-account default-expense-account
|
||||
:invoice-reminder-schedule invoice-reminder-schedule
|
||||
:invoice-reminder-schedule nil
|
||||
:address (remove-nils #:address {:street1 (:street1 address)
|
||||
:street2 (:street2 address)
|
||||
:city (:city address)
|
||||
@@ -547,7 +546,9 @@
|
||||
:email primary-email})
|
||||
:secondary-contact (remove-nils #:contact {:name secondary-contact
|
||||
:phone secondary-phone
|
||||
:email secondary-email})}))))))
|
||||
:email secondary-email})}))))
|
||||
)
|
||||
)
|
||||
|
||||
(defn load-clients [clients]
|
||||
(->> clients
|
||||
@@ -606,10 +607,10 @@
|
||||
(map
|
||||
(fn [{:keys [id expense-account-id location amount invoice-id]}]
|
||||
[(remove-nils #:invoice {:original-id invoice-id
|
||||
:expense-accounts [#:invoice-expense-account {:original-id id
|
||||
:expense-accounts [(remove-nils #:invoice-expense-account {:original-id id
|
||||
:expense-account-id expense-account-id
|
||||
:location location
|
||||
:amount (double amount)}]})]))))
|
||||
:amount (double amount)})]})]))))
|
||||
|
||||
|
||||
(defn load-payments [checks]
|
||||
@@ -622,7 +623,9 @@
|
||||
:s3-url s3-url
|
||||
:vendor (when vendor-id [:vendor/original-id vendor-id])
|
||||
:client [:client/original-id company-id]
|
||||
:bank-account (when bank-account-id [:bank-account/original-id (str company-id "-" bank-account-id)])
|
||||
:bank-account (when (and bank-account-id
|
||||
(not= "38-3" (str company-id "-" bank-account-id))) ;; TODO - 38-3 got removed at some ponitn
|
||||
[:bank-account/original-id (str company-id "-" bank-account-id)])
|
||||
:check-number check-number
|
||||
:memo memo
|
||||
:date (coerce/to-date date)
|
||||
@@ -644,28 +647,33 @@
|
||||
:amount (double amount)})]))))
|
||||
|
||||
(defn load-transactions [transactions]
|
||||
(->> transactions
|
||||
(map
|
||||
(fn [{:keys [id amount description-original description-simple merchant-id merchant-name
|
||||
date post-date type account-id status vendor-id company-id check-id check-number
|
||||
bank-account-id]}]
|
||||
[(remove-nils #:transaction {:original-id id
|
||||
:description-original description-original
|
||||
:description-simple description-simple
|
||||
:merchant-id merchant-id
|
||||
:merchant-name merchant-name
|
||||
:date (coerce/to-date date)
|
||||
:post-date (coerce/to-date post-date)
|
||||
:type type
|
||||
:status status
|
||||
:amount (double amount)
|
||||
:account-id account-id
|
||||
:check-number check-number
|
||||
:vendor (when vendor-id [:vendor/original-id vendor-id])
|
||||
:client (when company-id [:client/original-id company-id])
|
||||
:payment (when check-id [:payment/original-id check-id])
|
||||
:bank-account (when bank-account-id
|
||||
[:bank-account/original-id (str company-id "-" bank-account-id)])})]))))
|
||||
(let [transactions (->> transactions
|
||||
(map
|
||||
(fn [{:keys [id amount description-original description-simple merchant-id merchant-name
|
||||
date post-date type account-id status vendor-id company-id check-id check-number
|
||||
bank-account-id]}]
|
||||
(remove-nils #:transaction {:original-id id
|
||||
:id id
|
||||
:description-original description-original
|
||||
:description-simple description-simple
|
||||
:merchant-id merchant-id
|
||||
:merchant-name merchant-name
|
||||
:date (coerce/to-date date)
|
||||
:post-date (coerce/to-date post-date)
|
||||
:type type
|
||||
:status status
|
||||
:amount (double amount)
|
||||
:account-id account-id
|
||||
:check-number check-number
|
||||
:vendor (when vendor-id [:vendor/original-id vendor-id])
|
||||
:client (when company-id [:client/original-id company-id])
|
||||
:payment (when check-id [:payment/original-id check-id])
|
||||
:bank-account (when (and bank-account-id
|
||||
(not= "38-3" (str company-id "-" bank-account-id)))
|
||||
[:bank-account/original-id (str company-id "-" bank-account-id)])})))
|
||||
(partition-all 10))]
|
||||
(println "transactions: " (count transactions) "batches of 50")
|
||||
transactions))
|
||||
|
||||
(defn load-users [users]
|
||||
(->> users
|
||||
|
||||
Reference in New Issue
Block a user