cleans up grids
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
(ns auto-ap.ssr.company.yodlee
|
||||
(:require [auto-ap.datomic
|
||||
(:require
|
||||
[auto-ap.datomic
|
||||
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query
|
||||
pull-attr pull-many query2]]
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client is-admin?]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.grid-page-helper :as helper]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils :refer [html-response modal-response]]
|
||||
[auto-ap.time :as atime]
|
||||
[auto-ap.yodlee.core2 :as yodlee]
|
||||
[bidi.bidi :as bidi]
|
||||
[config.core :refer [env]]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]))
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client is-admin?]]
|
||||
[auto-ap.permissions :refer [wrap-must]]
|
||||
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
||||
[auto-ap.routes.utils :refer [wrap-client-redirect-unauthenticated
|
||||
wrap-secure]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils :refer [apply-middleware-to-all-handlers
|
||||
default-grid-fields-schema entity-id
|
||||
html-response modal-response wrap-merge-prior-hx
|
||||
wrap-schema-enforce]]
|
||||
[auto-ap.time :as atime]
|
||||
[auto-ap.yodlee.core2 :as yodlee]
|
||||
[bidi.bidi :as bidi]
|
||||
[config.core :refer [env]]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]
|
||||
[malli.core :as mc]))
|
||||
|
||||
(def default-read '[:db/id
|
||||
[:yodlee-provider-account/last-updated :xform clj-time.coerce/from-date]
|
||||
@@ -23,11 +32,15 @@
|
||||
{:yodlee-provider-account/accounts [:yodlee-account/name :yodlee-account/number]
|
||||
:yodlee-provider-account/client [:client/code]}])
|
||||
|
||||
|
||||
(def query-schema (mc/schema
|
||||
[:maybe
|
||||
(into [:map {}
|
||||
[:client-id {:optional true} [:maybe entity-id]] ]
|
||||
default-grid-fields-schema)]))
|
||||
|
||||
(defn fetch-ids [db request]
|
||||
(let [query-params (:parsed-query-params request)]
|
||||
(->> (cond-> {:query {:find []
|
||||
(let [query-params (:query-params request)
|
||||
query (cond-> {:query {:find []
|
||||
:in ['$ '[?xx ...]]
|
||||
:where ['[?e :yodlee-provider-account/id]
|
||||
'[?e :yodlee-provider-account/client ?xx]]}
|
||||
@@ -35,11 +48,15 @@
|
||||
|
||||
|
||||
(:sort query-params) (add-sorter-fields {"status" ['[?e :yodlee-provider-account/status ?sort-status]]
|
||||
"last-updated" ['[?e :yodlee-provider-account/last-updated ?sort-last-updated]]}
|
||||
"client" ['[?e :yodlee-provider-account/client ?c]
|
||||
'[?c :client/code ?sort-client]]
|
||||
"provider-account" ['[?e :yodlee-provider-account/id ?sort-provider-account]]
|
||||
"last-updated" ['[?e :yodlee-provider-account/last-updated ?sort-last-updated]]}
|
||||
query-params)
|
||||
true
|
||||
(merge-query {:query {:find ['?e ]
|
||||
:where ['[?e :yodlee-provider-account/id]]}}))
|
||||
:where ['[?e :yodlee-provider-account/id]]}}))]
|
||||
(->> query
|
||||
|
||||
(query2)
|
||||
(apply-sort-3 query-params)
|
||||
@@ -133,6 +150,7 @@ fastlink.open({fastLinkURL: '%s',
|
||||
"Yodlee"]]
|
||||
:title "Yodlee Accounts"
|
||||
:entity-name "Yodlee accounts"
|
||||
:query-schema query-schema
|
||||
:route :company-yodlee-table
|
||||
:action-buttons (fn [request]
|
||||
[[:div.flex.flex-col.flex-shrink
|
||||
@@ -211,3 +229,21 @@ fastlink.open({fastLinkURL: '%s',
|
||||
identity
|
||||
provider-account
|
||||
{:flash? true}))))
|
||||
|
||||
|
||||
(def key->handler
|
||||
(apply-middleware-to-all-handlers
|
||||
{
|
||||
:company-yodlee page
|
||||
:company-yodlee-table table
|
||||
:company-yodlee-fastlink-dialog fastlink-dialog
|
||||
}
|
||||
(fn [h]
|
||||
(-> h
|
||||
(wrap-copy-qp-pqp)
|
||||
(wrap-apply-sort grid-page)
|
||||
(wrap-merge-prior-hx)
|
||||
(wrap-schema-enforce :query-schema query-schema)
|
||||
(wrap-schema-enforce :hx-schema query-schema)
|
||||
(wrap-client-redirect-unauthenticated)
|
||||
(wrap-secure)))))
|
||||
Reference in New Issue
Block a user