diff pkg/controllers/routes.go @ 2147:b66cfcde8ff7

Print templates: Stubbed endpoints under /api/templates/print/{name}
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 08 Feb 2019 11:02:05 +0100
parents e6dccc7a3ea1
children 51c5aead78c0
line wrap: on
line diff
--- a/pkg/controllers/routes.go	Thu Feb 07 17:45:00 2019 +0100
+++ b/pkg/controllers/routes.go	Fri Feb 08 11:02:05 2019 +0100
@@ -95,6 +95,27 @@
 		NoConn: true,
 	}).Methods(http.MethodGet)
 
+	// Print templates
+	api.Handle("/templates/print", any(&JSONHandler{
+		Handle: listPrintTemplates,
+	})).Methods(http.MethodGet)
+
+	api.Handle("/templates/print/{name}", any(&JSONHandler{
+		Handle: fetchPrintTemplate,
+	})).Methods(http.MethodGet)
+
+	api.Handle("/templates/print/{name}", waterwayAdmin(&JSONHandler{
+		Handle: createPrintTemplate,
+	})).Methods(http.MethodPost)
+
+	api.Handle("/templates/print/{name}", waterwayAdmin(&JSONHandler{
+		Handle: deletePrintTemplate,
+	})).Methods(http.MethodDelete)
+
+	api.Handle("/templates/print/{name}", waterwayAdmin(&JSONHandler{
+		Handle: updatePrintTemplate,
+	})).Methods(http.MethodPatch)
+
 	// External proxies.
 	external := middleware.NotFound(&httputil.ReverseProxy{
 		Director:       proxyDirector(models.ExternalServices.Find),