comparison pkg/controllers/routes.go @ 3217:4c254651d80b

Added template types "map", "diagram", "report".
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 09 May 2019 12:08:02 +0200
parents c8ded555c2a8
children 60f25cbe77fb
comparison
equal deleted inserted replaced
3216:ee6a4e8af766 3217:4c254651d80b
99 Handle: passwordReset, 99 Handle: passwordReset,
100 NoConn: true, 100 NoConn: true,
101 }).Methods(http.MethodGet) 101 }).Methods(http.MethodGet)
102 102
103 // Print templates 103 // Print templates
104 api.Handle("/templates/print", any(&JSONHandler{ 104 api.Handle("/templates", any(&JSONHandler{
105 Handle: listPrintTemplates, 105 Handle: listPrintTemplates,
106 })).Methods(http.MethodGet) 106 })).Methods(http.MethodGet)
107 107
108 api.Handle("/templates/print/{name}", any(&JSONHandler{ 108 tTypes := "{type:" + strings.Join(templateTypes, "|") + "}"
109
110 api.Handle("/templates/"+tTypes, any(&JSONHandler{
111 Handle: listPrintTemplates,
112 })).Methods(http.MethodGet)
113
114 api.Handle("/templates/"+tTypes+"/{name}", any(&JSONHandler{
109 Handle: fetchPrintTemplate, 115 Handle: fetchPrintTemplate,
110 })).Methods(http.MethodGet) 116 })).Methods(http.MethodGet)
111 117
112 api.Handle("/templates/print/{name}", waterwayAdmin(&JSONHandler{ 118 api.Handle("/templates/"+tTypes+"/{name}", waterwayAdmin(&JSONHandler{
113 Input: func(*http.Request) interface{} { return &json.RawMessage{} }, 119 Input: func(*http.Request) interface{} { return &json.RawMessage{} },
114 Handle: createPrintTemplate, 120 Handle: createPrintTemplate,
115 Limit: maxPrintTemplateSize, 121 Limit: maxPrintTemplateSize,
116 })).Methods(http.MethodPost) 122 })).Methods(http.MethodPost)
117 123
118 api.Handle("/templates/print/{name}", waterwayAdmin(&JSONHandler{ 124 api.Handle("/templates/"+tTypes+"/{name}", waterwayAdmin(&JSONHandler{
119 Handle: deletePrintTemplate, 125 Handle: deletePrintTemplate,
120 })).Methods(http.MethodDelete) 126 })).Methods(http.MethodDelete)
121 127
122 api.Handle("/templates/print/{name}", waterwayAdmin(&JSONHandler{ 128 api.Handle("/templates/"+tTypes+"/{name}", waterwayAdmin(&JSONHandler{
123 Input: func(*http.Request) interface{} { return &json.RawMessage{} }, 129 Input: func(*http.Request) interface{} { return &json.RawMessage{} },
124 Handle: updatePrintTemplate, 130 Handle: updatePrintTemplate,
125 Limit: maxPrintTemplateSize, 131 Limit: maxPrintTemplateSize,
126 })).Methods(http.MethodPatch) 132 })).Methods(http.MethodPatch)
127 133