you can now change types.

This commit is contained in:
Bryce Covert
2018-05-31 21:57:00 -07:00
parent 4c16c06457
commit 2f744be36c
7 changed files with 162 additions and 7 deletions

View File

@@ -29,3 +29,16 @@
[:= :i.id :nonexist.invoice-id]]
:where [:and [:= :nonexist.id nil]
[:not= :v.default-expense-account nil]] }] })))
(defn replace-for-invoice [invoice-id expense-accounts]
(j/db-do-prepared (get-conn)
(sql/format {:delete-from [:invoices-expense-accounts :i]
:where [:= :i.invoice-id invoice-id] }))
(println expense-accounts)
(j/insert-multi! (get-conn)
:invoices_expense_accounts
(doto (->> expense-accounts
(map (fn [x] (assoc x :invoice-id invoice-id)))
(map clj->db ))
println)) )