Adding transaction approval status to transaction page

This commit is contained in:
Bryce Covert
2019-05-17 07:14:16 -07:00
parent d0b5772d94
commit a87d22c320
9 changed files with 71 additions and 26 deletions

View File

@@ -4,7 +4,7 @@
[datomic.api :as d]
[auto-ap.datomic :refer [remove-nils uri merge-query replace-nils-with-retract]]
[auto-ap.utils :refer [dollars=]]
[auto-ap.graphql.utils :refer [->graphql <-graphql limited-clients assert-admin result->page snake->kebab]]
[auto-ap.graphql.utils :refer [->graphql <-graphql limited-clients assert-admin result->page snake->kebab ident->enum-f]]
[clj-time.coerce :as c]
[clojure.set :as set]
[clojure.string :as str]
@@ -13,9 +13,7 @@
[clj-time.coerce :as coerce])
(:import [java.time.temporal ChronoField]))
(defn ident->enum-f [k]
#(update % k
(fn [value] (some-> value :db/ident name keyword))))
(defn get-transaction-rule-page [context args value]
(let [args (assoc args :id (:id context))
@@ -47,7 +45,7 @@
:account account_id
:location location}))
;; TODO ASSERT ADMIN
(defn upsert-transaction-rule [context {{:keys [id description yodlee_merchant_id note client_id bank_account_id amount_lte amount_gte vendor_id accounts transaction_approval_status ]} :transaction_rule :as z} value]
(defn upsert-transaction-rule [context {{:keys [id description yodlee_merchant_id note client_id bank_account_id amount_lte amount_gte vendor_id accounts transaction_approval_status dom_gte dom_lte]} :transaction_rule :as z} value]
#_(assert-admin (:id context))
(let [existing-transaction (tr/get-by-id id)
deleted (deleted-accounts existing-transaction accounts)
@@ -67,6 +65,8 @@
:client client_id
:bank-account bank_account_id
:yodlee-merchant yodlee_merchant_id
:dom-lte dom_lte
:dom-gte dom_gte
:amount-lte amount_lte
:amount-gte amount_gte
:vendor vendor_id
@@ -78,7 +78,6 @@
:accounts (map transaction-rule-account->entity accounts)}
existing-transaction)
_ (println transaction)
transaction (into transaction
(map (fn [d]