Skip to content

Commit 28048cb

Browse files
committed
Move csv routes into their own set
1 parent 595b148 commit 28048cb

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/main/lrsql/admin/routes.clj

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,22 @@
243243
400 (g/rref :error-400)
244244
401 (g/rref :error-401)}})})
245245

246+
(defn admin-csv-routes
247+
[common-interceptors-no-auth
248+
common-interceptors jwt-secret jwt-exp jwt-leeway no-val-opts]
249+
#{["/admin/csv/auth" :get (conj common-interceptors
250+
(ji/validate-jwt
251+
jwt-secret jwt-leeway no-val-opts)
252+
ji/validate-jwt-account
253+
(lm/generate-one-time-jwt jwt-secret jwt-exp))
254+
:route-name :lrsql.lrs-management/download-csv-auth]
255+
["/admin/csv" :get (conj common-interceptors-no-auth
256+
lm/validate-property-paths
257+
lm/validate-query-params
258+
(ji/validate-one-time-jwt jwt-secret jwt-leeway)
259+
lm/download-statement-csv)
260+
:route-name :lrsql.lrs-management/download-csv]})
261+
246262
(defn admin-status-routes
247263
[common-interceptors jwt-secret jwt-leeway no-val-opts]
248264
#{;; Return LRS Status information
@@ -309,26 +325,13 @@
309325
:route-name :lrsql.admin.reaction/delete]})
310326

311327
(defn admin-lrs-management-routes
312-
[common-interceptors-no-auth
313-
common-interceptors jwt-secret jwt-exp jwt-leeway no-val-opts]
328+
[common-interceptors jwt-secret jwt-leeway no-val-opts]
314329
#{["/admin/agents" :delete (conj common-interceptors
315330
lm/validate-delete-actor-params
316331
(ji/validate-jwt jwt-secret jwt-leeway no-val-opts)
317332
ji/validate-jwt-account
318333
lm/delete-actor)
319-
:route-name :lrsql.lrs-management/delete-actor]
320-
["/admin/csv/auth" :get (conj common-interceptors
321-
(ji/validate-jwt
322-
jwt-secret jwt-leeway no-val-opts)
323-
ji/validate-jwt-account
324-
(lm/generate-one-time-jwt jwt-secret jwt-exp))
325-
:route-name :lrsql.lrs-management/download-csv-auth]
326-
["/admin/csv" :get (conj common-interceptors-no-auth
327-
lm/validate-property-paths
328-
lm/validate-query-params
329-
(ji/validate-one-time-jwt jwt-secret jwt-leeway)
330-
lm/download-statement-csv)
331-
:route-name :lrsql.lrs-management/download-csv]})
334+
:route-name :lrsql.lrs-management/delete-actor]})
332335

333336
(defn add-admin-routes
334337
"Given a set of routes `routes` for a default LRS implementation,
@@ -375,6 +378,8 @@
375378
common-interceptors-oidc secret exp ref leeway no-val-opts))
376379
(admin-cred-routes
377380
common-interceptors-oidc secret leeway no-val-opts)
381+
(admin-csv-routes
382+
common-interceptors common-interceptors-oidc secret exp leeway no-val-opts)
378383
(when enable-admin-ui
379384
(admin-ui-routes
380385
(into common-interceptors
@@ -397,7 +402,7 @@
397402
common-interceptors-oidc secret leeway no-val-opts))
398403
(when enable-admin-delete-actor
399404
(admin-lrs-management-routes
400-
common-interceptors common-interceptors-oidc secret exp leeway no-val-opts)))))
405+
common-interceptors-oidc secret leeway no-val-opts)))))
401406

402407
(defn add-openapi-route [{:keys [lrs head-opts version]} routes]
403408
(let [common-interceptors (make-common-interceptors lrs head-opts)]

0 commit comments

Comments
 (0)