Vendors form progress

This commit is contained in:
2023-11-02 23:40:24 -07:00
parent 99e4f05769
commit eef1cfb919
16 changed files with 846 additions and 425 deletions

View File

@@ -36,7 +36,7 @@
temp-id
wrap-entity
wrap-form-4xx-2
wrap-schema-decode]]
wrap-schema-enforce]]
[bidi.bidi :as bidi]
[clojure.string :as str]
[datomic.api :as dc]
@@ -412,18 +412,18 @@
{:admin-accounts (helper/page-route grid-page)
:admin-account-table (helper/table-route grid-page)
:admin-account-client-override-new (-> new-client-override
(wrap-schema-decode :query-schema [:map
(wrap-schema-enforce :query-schema [:map
[:index {:optional true
:default 0} [nat-int? {:default 0}]]])
wrap-admin wrap-client-redirect-unauthenticated)
:admin-account-save (-> account-save
(wrap-entity [:form-params :db/id] default-read)
(wrap-schema-decode :form-schema form-schema)
(wrap-schema-enforce :form-schema form-schema)
(wrap-nested-form-params)
(wrap-form-4xx-2 (wrap-entity account-dialog [:form-params :db/id] default-read)))
:admin-account-edit-dialog (-> account-dialog
(wrap-entity [:route-params :db/id] default-read)
(wrap-schema-decode :route-schema [:map [:db/id entity-id]]))
(wrap-schema-enforce :route-schema [:map [:db/id entity-id]]))
:admin-account-new-dialog account-dialog})
(fn [h]
(-> h

View File

@@ -16,7 +16,7 @@
html-response
modal-response
wrap-form-4xx-2
wrap-schema-decode]]
wrap-schema-enforce]]
[auto-ap.time :as atime]
[bidi.bidi :as bidi]
[clj-time.coerce :as coerce]
@@ -256,9 +256,9 @@
(->>
{:admin-jobs (helper/page-route grid-page)
:admin-job-table (helper/table-route grid-page)
:admin-job-subform (-> subform (wrap-schema-decode :query-schema [:map [:name {:optional true} [:maybe :string]]]))
:admin-job-subform (-> subform (wrap-schema-enforce :query-schema [:map [:name {:optional true} [:maybe :string]]]))
:admin-job-start (-> job-start
(wrap-schema-decode :form-schema form-schema)
(wrap-schema-enforce :form-schema form-schema)
(wrap-nested-form-params)
(wrap-form-4xx-2 job-start-dialog))
:admin-job-start-dialog job-start-dialog})

View File

@@ -19,7 +19,7 @@
:refer [apply-middleware-to-all-handlers
html-response
wrap-form-4xx-2
wrap-schema-decode]]
wrap-schema-enforce]]
[auto-ap.utils :refer [by]]
[bidi.bidi :as bidi]
[clj-time.coerce :as coerce]
@@ -311,7 +311,7 @@
(->>
{::route/page page
::route/import (-> import
(wrap-schema-decode :form-schema [:map [:tsv :string]])
(wrap-schema-enforce :form-schema [:map [:tsv :string]])
(wrap-nested-form-params)
(wrap-form-4xx-2 form))
})

View File

@@ -45,7 +45,7 @@
temp-id
wrap-entity
wrap-form-4xx-2
wrap-schema-decode]]
wrap-schema-enforce]]
[auto-ap.time :as atime]
[auto-ap.utils :refer [dollars=]]
[bidi.bidi :as bidi]
@@ -832,6 +832,7 @@
{})
:form-errors form-errors})))
(defn check-badges [{query-params :query-params}]
(html-response
[:div (if (not-empty (:all query-params))
@@ -875,21 +876,21 @@
{::route/page (helper/page-route grid-page)
::route/table (helper/table-route grid-page)
::route/new-account (-> new-account
(wrap-schema-decode :query-schema [:map
(wrap-schema-enforce :query-schema [:map
[:client-id {:optional true}
[:maybe entity-id]]
[:index {:optional true
:default 0} [nat-int? {:default 0}]]])
wrap-admin wrap-client-redirect-unauthenticated)
::route/location-select (-> location-select
(wrap-schema-decode :query-schema [:map
(wrap-schema-enforce :query-schema [:map
[:name :string]
[:client-id {:optional true}
[:maybe entity-id]]
[:account-id {:optional true}
[:maybe entity-id]]]))
::route/account-typeahead (-> account-typeahead
(wrap-schema-decode :query-schema [:map
(wrap-schema-enforce :query-schema [:map
[:name :string]
[:client-id {:optional true}
[:maybe entity-id]]
@@ -897,7 +898,7 @@
[:maybe entity-id]]]))
::route/save (-> save
(wrap-entity [:form-params :db/id] default-read)
(wrap-schema-decode :form-schema form-schema)
(wrap-schema-enforce :form-schema form-schema)
(wrap-nested-form-params)
(wrap-form-4xx-2 (-> edit-dialog
(wrap-entity [:form-params :db/id] default-read))))
@@ -905,8 +906,8 @@
::route/execute (-> execute
(wrap-entity [:route-params :db/id] default-read)
(wrap-entity [:route-params :db/id] default-read)
(wrap-schema-decode :route-schema [:map [:db/id entity-id]])
(wrap-schema-decode :form-schema
(wrap-schema-enforce :route-schema [:map [:db/id entity-id]])
(wrap-schema-enforce :form-schema
[:map
[:transaction-id {:optional true}
[:maybe [:vector {:decode/arbitrary (fn [x] ;; TODO make this easier
@@ -920,13 +921,13 @@
::route/test (-> test
(wrap-entity [:form-params :db/id] default-read)
(wrap-schema-decode :form-schema form-schema)
(wrap-schema-enforce :form-schema form-schema)
(wrap-nested-form-params)
(wrap-form-4xx-2 (-> edit-dialog
(wrap-entity [:form-params :db/id] default-read))))
::route/check-badges (-> check-badges
(wrap-schema-decode :query-schema [:map
(wrap-schema-enforce :query-schema [:map
[:transaction-id {:optional true}
[:maybe [:vector {:decode/arbitrary (fn [x]
(if (sequential? x)
@@ -936,11 +937,11 @@
[:all {:optional true} [:maybe :string]]]))
::route/execute-dialog (-> execute-dialog
(wrap-entity [:route-params :db/id] default-read)
(wrap-schema-decode :route-schema [:map [:db/id entity-id]]))
(wrap-schema-enforce :route-schema [:map [:db/id entity-id]]))
::route/edit-dialog (-> edit-dialog
(wrap-entity [:route-params :db/id] default-read)
(wrap-schema-decode :route-schema [:map [:db/id entity-id]]))
(wrap-schema-enforce :route-schema [:map [:db/id entity-id]]))
::route/new-dialog edit-dialog})
(fn [h]
(-> h

File diff suppressed because it is too large Load Diff