allows adding

This commit is contained in:
Bryce Covert
2018-08-05 19:51:18 -07:00
parent a9d8bf21f9
commit 2e8a7b4648
8 changed files with 183 additions and 25 deletions

View File

@@ -45,4 +45,13 @@
(Integer/parseInt id))))
(defn add-bank-account [id bank-account]
(let [company (get-by-id id)
company (update company :bank-accounts
(fn [ba]
(let [next-id (inc (apply max (conj (map :id ba) 0)))]
(conj (vec ba) (assoc bank-account :id next-id)))))]
(upsert id company)))