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.vendors :as gq-vendors]
[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.time :as time]
[clj-time.coerce :as coerce]
@@ -352,9 +351,7 @@
:cash_flow {:type :cash_flow_result
:args {:client_id {:type :id}}
: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
:args {:name_like {:type 'String}
@@ -794,7 +791,6 @@
(-> integreat-schema
(attach-tracing-resolvers
{
:get-yodlee-provider-account-page gq-yodlee2/get-yodlee-provider-account-page
:get-accounts gq-accounts/get-graphql
:get-all-accounts gq-accounts/get-all-graphql
: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
(let [stream (s/stream 100)]
(->> stream
(s/throttle 80)
(s/throttle 50)
(s/map (fn [[request attempt response-deferred]]
(de/catch
(de/chain
@@ -47,8 +47,8 @@
:background-job "Square 3")
(try
(client/request (assoc request
:socket-timeout 5000
:connection-timeout 5000
:socket-timeout 10000
:connection-timeout 10000
#_#_:connection-request-timeout 5000
:as :json))
(catch Throwable e
@@ -60,7 +60,7 @@
(if (>= attempt 5)
(throw e)
(de/chain
(mt/in 1000 (fn [] 1))
(mt/in 10000 (fn [] 1))
(fn [_] (de/recur (inc attempt)))))))
(de/chain identity)))
(fn [result]
@@ -383,7 +383,7 @@
(daily-results client location (time/plus (time/now) (time/days -7)) (time/now)))
([client location start end]
(capture-context->lc
(->
(->
(de/chain (search client location start end)
(fn [search-results]
(->> (or search-results [])

View File

@@ -46,15 +46,19 @@
::input-value-settled
[with-user]
(fn [{:keys [user]} [_ input-value search-query set-items set-loading-status]]
(when (> (count input-value) 2)
(set-loading-status :loading)
(if (re-matches #"[a-zA-Z0-9\s\-]+" input-value)
(when (> (count input-value) 2)
(set-loading-status :loading)
{:graphql {:token user
:query-obj {:venia/queries [{:query/data (search-query input-value )
:query/alias :search-results}]}
:on-success [::search-completed set-items set-loading-status]
:on-error [::search-failed set-loading-status]}})))
{:graphql {:token user
:query-obj {:venia/queries [{:query/data (search-query input-value )
:query/alias :search-results}]}
:on-success [::search-completed set-items 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
(defn state-reducer [^js/FakeStateObject state ^js/FakeActionsAndChanges actions-and-changes]

View File

@@ -32,7 +32,7 @@
:start (:start params 0)
:per-page (:per-page 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]
:total
:start

View File

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