a variety of bug fixes.

This commit is contained in:
2023-09-29 09:05:17 -07:00
parent 829c857122
commit f8b76b6c2c
6 changed files with 28 additions and 41 deletions

View File

@@ -20,7 +20,6 @@
[auto-ap.graphql.utils :refer [assert-admin attach-tracing-resolvers]] [auto-ap.graphql.utils :refer [assert-admin attach-tracing-resolvers]]
[auto-ap.graphql.vendors :as gq-vendors] [auto-ap.graphql.vendors :as gq-vendors]
[auto-ap.graphql.yodlee-merchants :as ym] [auto-ap.graphql.yodlee-merchants :as ym]
[auto-ap.graphql.yodlee2 :as gq-yodlee2]
[auto-ap.logging :as alog :refer [error-event info-event warn-event]] [auto-ap.logging :as alog :refer [error-event info-event warn-event]]
[auto-ap.time :as time] [auto-ap.time :as time]
[clj-time.coerce :as coerce] [clj-time.coerce :as coerce]
@@ -352,9 +351,7 @@
:cash_flow {:type :cash_flow_result :cash_flow {:type :cash_flow_result
:args {:client_id {:type :id}} :args {:client_id {:type :id}}
:resolve :get-cash-flow} :resolve :get-cash-flow}
:yodlee_provider_account_page {:type :yodlee_provider_account_page
:args {:client_id {:type :id}}
:resolve :get-yodlee-provider-account-page}
:account_page {:type :account_page :account_page {:type :account_page
:args {:name_like {:type 'String} :args {:name_like {:type 'String}
@@ -794,7 +791,6 @@
(-> integreat-schema (-> integreat-schema
(attach-tracing-resolvers (attach-tracing-resolvers
{ {
:get-yodlee-provider-account-page gq-yodlee2/get-yodlee-provider-account-page
:get-accounts gq-accounts/get-graphql :get-accounts gq-accounts/get-graphql
:get-all-accounts gq-accounts/get-all-graphql :get-all-accounts gq-accounts/get-all-graphql
:get-transaction-rule-page gq-transaction-rules/get-transaction-rule-page :get-transaction-rule-page gq-transaction-rules/get-transaction-rule-page

View File

@@ -1,14 +0,0 @@
(ns auto-ap.graphql.yodlee2
(:require
[auto-ap.datomic.yodlee2 :as d-yodlee2]
[auto-ap.graphql.utils :refer [->graphql <-graphql]]))
(defn get-yodlee-provider-account-page [context args _]
(let [args (assoc args :id (:id context))
[yodlee-provider-accounts cnt] (d-yodlee2/get-graphql (<-graphql (assoc args :clients (:clients context))))]
{:yodlee_provider_accounts (map ->graphql yodlee-provider-accounts)
:total cnt
:count (count yodlee-provider-accounts)
:start (:start args 0)
:end (+ (:start args 0) (count yodlee-provider-accounts))}))

View File

@@ -34,7 +34,7 @@
(def manifold-api-stream (def manifold-api-stream
(let [stream (s/stream 100)] (let [stream (s/stream 100)]
(->> stream (->> stream
(s/throttle 80) (s/throttle 50)
(s/map (fn [[request attempt response-deferred]] (s/map (fn [[request attempt response-deferred]]
(de/catch (de/catch
(de/chain (de/chain
@@ -47,8 +47,8 @@
:background-job "Square 3") :background-job "Square 3")
(try (try
(client/request (assoc request (client/request (assoc request
:socket-timeout 5000 :socket-timeout 10000
:connection-timeout 5000 :connection-timeout 10000
#_#_:connection-request-timeout 5000 #_#_:connection-request-timeout 5000
:as :json)) :as :json))
(catch Throwable e (catch Throwable e
@@ -60,7 +60,7 @@
(if (>= attempt 5) (if (>= attempt 5)
(throw e) (throw e)
(de/chain (de/chain
(mt/in 1000 (fn [] 1)) (mt/in 10000 (fn [] 1))
(fn [_] (de/recur (inc attempt))))))) (fn [_] (de/recur (inc attempt)))))))
(de/chain identity))) (de/chain identity)))
(fn [result] (fn [result]
@@ -383,7 +383,7 @@
(daily-results client location (time/plus (time/now) (time/days -7)) (time/now))) (daily-results client location (time/plus (time/now) (time/days -7)) (time/now)))
([client location start end] ([client location start end]
(capture-context->lc (capture-context->lc
(-> (->
(de/chain (search client location start end) (de/chain (search client location start end)
(fn [search-results] (fn [search-results]
(->> (or search-results []) (->> (or search-results [])

View File

@@ -46,15 +46,19 @@
::input-value-settled ::input-value-settled
[with-user] [with-user]
(fn [{:keys [user]} [_ input-value search-query set-items set-loading-status]] (fn [{:keys [user]} [_ input-value search-query set-items set-loading-status]]
(when (> (count input-value) 2) (if (re-matches #"[a-zA-Z0-9\s\-]+" input-value)
(set-loading-status :loading) (when (> (count input-value) 2)
(set-loading-status :loading)
{:graphql {:token user {:graphql {:token user
:query-obj {:venia/queries [{:query/data (search-query input-value ) :query-obj {:venia/queries [{:query/data (search-query input-value )
:query/alias :search-results}]} :query/alias :search-results}]}
:on-success [::search-completed set-items set-loading-status] :on-success [::search-completed set-items set-loading-status]
:on-error [::search-failed set-loading-status]}}))) :on-error [::search-failed set-loading-status]}})
(do
(set-loading-status nil)
{}))))
;; TODO: This avoids the use of inferred externs by using aget. You could just use the ^js tag though ;; TODO: This avoids the use of inferred externs by using aget. You could just use the ^js tag though
(defn state-reducer [^js/FakeStateObject state ^js/FakeActionsAndChanges actions-and-changes] (defn state-reducer [^js/FakeStateObject state ^js/FakeActionsAndChanges actions-and-changes]

View File

@@ -32,7 +32,7 @@
:start (:start params 0) :start (:start params 0)
:per-page (:per-page params) :per-page (:per-page params)
:name-like (:name-like params) :name-like (:name-like params)
:numeric-code (some-> params :numeric-code not-empty js/parseInt)} :numeric-code (some-> params :numeric-code not-empty js/parseInt (#(if (js/Number.isNaN %) nil %)))}
[[:accounts default-read] [[:accounts default-read]
:total :total
:start :start

View File

@@ -211,14 +211,15 @@
::mounted ::mounted
[with-user (re-frame/inject-cofx ::inject/sub [::subs/route-params])] [with-user (re-frame/inject-cofx ::inject/sub [::subs/route-params])]
(fn [{:keys [user db] ::subs/keys [route-params]} _] (fn [{:keys [user db] ::subs/keys [route-params]} _]
{:graphql {:token user (when-let [id (some-> (:id route-params) (js/parseInt ) (#(if (js/Number.isNaN %) nil %)))]
:query-obj {:venia/queries [[:admin-client {:graphql {:token user
{:id (js/parseInt (:id route-params))} :query-obj {:venia/queries [[:admin-client
(events/client-detail-query user)]]} {:id id}
:on-success (fn [result] (events/client-detail-query user)]]}
[::received (:admin-client result)])} :on-success (fn [result]
:db (-> db [::received (:admin-client result)])}
(forms/stop-form ::form))})) :db (-> db
(forms/stop-form ::form))})))
(re-frame/reg-event-db (re-frame/reg-event-db
::received ::received