comparison pkg/controllers/routes.go @ 5386:fc3a5345b0fd extented-report

Added enpoint /api/data/stats-updates to list and trigger the stats update scripts. sys_admin only.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 01 Jul 2021 23:07:14 +0200
parents d19fdf3d2099
children 8e30b926b94d
comparison
equal deleted inserted replaced
5385:7f5fc8ece589 5386:fc3a5345b0fd
342 })).Methods(http.MethodGet) 342 })).Methods(http.MethodGet)
343 343
344 api.Handle("/data/report/{name:"+models.SafePathExp+"}", waterwayAdmin( 344 api.Handle("/data/report/{name:"+models.SafePathExp+"}", waterwayAdmin(
345 mw.DBConn(http.HandlerFunc(report)))).Methods(http.MethodGet) 345 mw.DBConn(http.HandlerFunc(report)))).Methods(http.MethodGet)
346 346
347 // Handler for update scripts
348 api.Handle("/data/stats-updates",
349 sysAdmin(&mw.JSONHandler{
350 Handle: listStatsUpdates,
351 })).Methods(http.MethodGet)
352
353 api.Handle("/data/stats-updates/{name:.+}",
354 sysAdmin(&mw.JSONHandler{
355 Handle: statsUpdates,
356 })).Methods(http.MethodGet)
357
347 // Handler to serve data to the client. 358 // Handler to serve data to the client.
348 359
349 api.Handle("/data/{type:availability|fairway}/{kind:stretch|section|bottleneck}/{name:.+}", any( 360 api.Handle("/data/{type:availability|fairway}/{kind:stretch|section|bottleneck}/{name:.+}", any(
350 mw.DBConn(http.HandlerFunc(fairwayAvailability)))).Methods(http.MethodGet) 361 mw.DBConn(http.HandlerFunc(fairwayAvailability)))).Methods(http.MethodGet)
351 362