weekly debits/credits.

This commit is contained in:
Bryce Covert
2020-05-30 11:49:21 -07:00
parent 3101dd1fe6
commit bb2df01d89
9 changed files with 140 additions and 56 deletions

View File

@@ -27,45 +27,47 @@
(mapv (fn [lm] [:db/retractEntity (:db/id lm)]) (:client/location-matches client))
(mapv (fn [m] [:db/retract (:db/id client) :client/matches m]) (:client/matches client)))))
transactions [(remove-nils {:db/id id
:client/code (if (str/blank? (:client/code client))
(:code edit_client)
(:client/code client))
:client/name (:name edit_client)
:client/code (if (str/blank? (:client/code client))
(:code edit_client)
(:client/code client))
:client/name (:name edit_client)
:client/matches (:matches edit_client)
:client/email (:email edit_client)
:client/locations (filter identity (:locations edit_client))
:client/email (:email edit_client)
:client/locations (filter identity (:locations edit_client))
:client/weekly-debits (:weekly_debits edit_client)
:client/weekly-credits (:weekly_credits edit_client)
:client/location-matches (->> (:location_matches edit_client)
(filter (fn [lm] (and (:location lm) (:match lm))))
(map (fn [lm] {:location-match/location (:location lm)
:location-match/matches [(:match lm)]})))
:client/address (remove-nils {
:address/street1 (:street1 (:address edit_client))
:address/street2 (:street2 (:address edit_client))
:address/city (:city (:address edit_client))
:address/state (:state (:address edit_client))
:address/zip (:zip (:address edit_client))})
:client/address (remove-nils {
:address/street1 (:street1 (:address edit_client))
:address/street2 (:street2 (:address edit_client))
:address/city (:city (:address edit_client))
:address/state (:state (:address edit_client))
:address/zip (:zip (:address edit_client))})
:client/bank-accounts (map #(remove-nils
{:db/id (:id %)
:bank-account/code (:code %)
:bank-account/bank-name (:bank_name %)
:bank-account/bank-code (:bank_code %)
:bank-account/routing (:routing %)
:bank-account/include-in-reports (:include_in_reports %)
:client/bank-accounts (map #(remove-nils
{:db/id (:id %)
:bank-account/code (:code %)
:bank-account/bank-name (:bank_name %)
:bank-account/bank-code (:bank_code %)
:bank-account/routing (:routing %)
:bank-account/include-in-reports (:include_in_reports %)
:bank-account/name (:name %)
:bank-account/visible (:visible %)
:bank-account/number (:number %)
:bank-account/check-number (:check_number %)
:bank-account/sort-order (:sort_order %)
:bank-account/locations (:locations %)
:bank-account/name (:name %)
:bank-account/visible (:visible %)
:bank-account/number (:number %)
:bank-account/check-number (:check_number %)
:bank-account/sort-order (:sort_order %)
:bank-account/locations (:locations %)
:bank-account/yodlee-account-id (:yodlee_account_id %)
:bank-account/type (keyword "bank-account-type" (name (:type %)))
}
) (:bank_accounts edit_client))
:bank-account/yodlee-account-id (:yodlee_account_id %)
:bank-account/type (keyword "bank-account-type" (name (:type %)))
}
) (:bank_accounts edit_client))
})]
})]
result @(d/transact (d/connect uri) transactions)]
(println result "ID" id)
(-> result :tempids (get id) (or id) d-clients/get-by-id