Starting to add locked until

This commit is contained in:
Bryce Covert
2022-03-13 12:04:59 -07:00
parent 96dd99a74c
commit ab4a426369
12 changed files with 207 additions and 117 deletions

View File

@@ -4,7 +4,7 @@
[auto-ap.graphql.utils :refer [->graphql assert-admin can-see-client? is-admin?]]
[auto-ap.utils :refer [by]]
[auto-ap.yodlee.core :refer [in-memory-cache]]
[com.walmartlabs.lacinia.util :refer [attach-resolvers]]
[clj-time.coerce :as coerce]
[config.core :refer [env]]
[clojure.string :as str]
@@ -95,6 +95,7 @@
:client/matches (:matches edit_client)
:client/signature-file signature-file
:client/email (:email edit_client)
:client/locked-until (some-> (:locked_until edit_client) (coerce/to-date))
:client/locations (filter identity (:locations edit_client))
:client/week-a-debits (:week_a_debits edit_client)
:client/week-a-credits (:week_a_credits edit_client)
@@ -256,3 +257,138 @@
(assoc ba :bank-account/yodlee-balance-old (get-in (by :id (mapcat :accounts @in-memory-cache) )
[(:bank-account/yodlee-account-id ba) :balance :amount])))
bank-accounts))))))))
(def objects
{:location_match
{:fields {:location {:type 'String}
:match {:type 'String}
:id {:type :id}}}
:client
{:fields {:id {:type :id}
:name {:type 'String}
:locked_until {:type :iso_date}
:code {:type 'String}
:signature_file {:type 'String}
:week_a_debits {:type :money}
:week_a_credits {:type :money}
:week_b_debits {:type :money}
:week_b_credits {:type :money}
:email {:type 'String}
:address {:type :address}
:location_matches {:type '(list :location_match)}
:locations {:type '(list String)}
:matches {:type '(list String)}
:bank_accounts {:type '(list :bank_account)}
:forecasted_transactions {:type '(list :forecasted_transaction)}
:yodlee_provider_accounts {:type '(list :yodlee_provider_account)}
:plaid_items {:type '(list :plaid_item)}}}
:bank_account
{:fields {:id {:type :id}
:type {:type :ident}
:start_date {:type :iso_date}
:number {:type 'String}
:numeric_code {:type 'Int}
:sort_order {:type 'Int}
:visible {:type 'Boolean}
:include_in_reports {:type 'Boolean}
:routing {:type 'String}
:code {:type 'String}
:check_number {:type 'Int}
:name {:type 'String}
:bank_code {:type 'String}
:bank_name {:type 'String}
:current_balance {:type :money}
:yodlee_balance_old {:type :money}
:yodlee_account_id {:type 'Int}
:yodlee_account {:type :yodlee_account}
:plaid_account {:type :plaid_account}
:intuit_bank_account {:type :intuit_bank_account}
:locations {:type '(list String)}}}
:forecasted_transaction {:fields {:identifier {:type 'String}
:id {:type :id}
:day_of_month {:type 'Int}
:amount {:type :money}}}
})
(def queries
{:client {:type '(list :client)
:resolve :get-client}})
(def mutations
{:edit_client {:type :client
:args {:edit_client {:type :edit_client}}
:resolve :mutation/edit-client}})
(def input-objects
{:edit_location_match {:fields {:location {:type 'String}
:match {:type 'String}
:id {:type :id}}}
:edit_forecasted_transaction {:fields {:identifier {:type 'String}
:id {:type :id}
:day_of_month {:type 'Int}
:amount {:type :money}}}
:edit_client {:fields {:id {:type :id}
:name {:type 'String}
:locked_until {:type :iso_date}
:code {:type 'String}
:signature_data {:type 'String}
:email {:type 'String}
:week_a_credits {:type :money}
:week_a_debits {:type :money}
:week_b_credits {:type :money}
:week_b_debits {:type :money}
:address {:type :add_address}
:locations {:type '(list String)}
:matches {:type '(list String)}
:location_matches {:type '(list :edit_location_match)}
:bank_accounts {:type '(list :edit_bank_account)}
:forecasted_transactions {:type '(list :edit_forecasted_transaction)}}}
:edit_bank_account
{:fields {:id {:type :id}
:code {:type 'String}
:type {:type :bank_account_type}
:start_date {:type :iso_date}
:number {:type 'String}
:check_number {:type 'Int}
:numeric_code {:type 'Int}
:visible {:type 'Boolean}
:include_in_reports {:type 'Boolean}
:sort_order {:type 'Int}
:name {:type 'String}
:bank_code {:type 'String}
:routing {:type 'String}
:bank_name {:type 'String}
:locations {:type '(list String)}
:yodlee_account_id {:type 'Int}
:intuit_bank_account {:type :id}
:plaid_account {:type :id}
:yodlee_account {:type 'Int}}}})
(def enums
{:bank_account_type {:values [{:enum-value :check}
{:enum-value :credit}
{:enum-value :cash}]}})
(def resolvers
{:get-client get-client
:mutation/edit-client edit-client})
(defn attach [schema]
(->
(merge-with merge schema
{:objects objects
:queries queries
:mutations mutations
:input-objects input-objects
:enums enums})
(attach-resolvers resolvers)))