removed old database stuff, just left what's needed for importing
This commit is contained in:
@@ -26,32 +26,3 @@
|
||||
|
||||
(defn get-all []
|
||||
(map data->fields (query base-query)))
|
||||
|
||||
(defn get-by-id [id]
|
||||
(first (map data->fields
|
||||
(query (-> base-query
|
||||
(helpers/merge-where [:= :id id]))))))
|
||||
|
||||
(defn upsert [id data]
|
||||
(-> (sql/build
|
||||
:update :companies
|
||||
:set (clj->db (select-keys (fields->data data) all-fields))
|
||||
:where [:= :id (if (int? id)
|
||||
id
|
||||
(Integer/parseInt id))])
|
||||
execute!)
|
||||
(get-by-id (if (int? id)
|
||||
id
|
||||
(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)))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user