Mercurial > gemma
comparison pkg/controllers/routes.go @ 1627:b10aa02d7819
Refactored: Moved REST /api/imports/scheduler to /api/imports/config
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 19 Dec 2018 15:58:44 +0100 |
parents | c12cec1d7692 |
children | dd31be75ce6d |
comparison
equal
deleted
inserted
replaced
1626:92da44ba610c | 1627:b10aa02d7819 |
---|---|
19 "net/http/httputil" | 19 "net/http/httputil" |
20 | 20 |
21 "github.com/gorilla/mux" | 21 "github.com/gorilla/mux" |
22 | 22 |
23 "gemma.intevation.de/gemma/pkg/auth" | 23 "gemma.intevation.de/gemma/pkg/auth" |
24 "gemma.intevation.de/gemma/pkg/imports" | |
24 "gemma.intevation.de/gemma/pkg/middleware" | 25 "gemma.intevation.de/gemma/pkg/middleware" |
25 "gemma.intevation.de/gemma/pkg/models" | 26 "gemma.intevation.de/gemma/pkg/models" |
26 ) | 27 ) |
27 | 28 |
28 func BindRoutes(m *mux.Router) { | 29 func BindRoutes(m *mux.Router) { |
174 Input: func() interface{} { return new(models.BottleneckImport) }, | 175 Input: func() interface{} { return new(models.BottleneckImport) }, |
175 Handle: importBottleneck, | 176 Handle: importBottleneck, |
176 })).Methods(http.MethodPost) | 177 })).Methods(http.MethodPost) |
177 | 178 |
178 // Import scheduler configuration | 179 // Import scheduler configuration |
179 api.Handle("/imports/scheduler/{id:[0-9]+}", | 180 api.Handle("/imports/config/{id:[0-9]+}", |
180 waterwayAdmin(&JSONHandler{ | 181 waterwayAdmin(&JSONHandler{ |
181 Handle: modifySchedule, | 182 Handle: modifyImportConfig, |
182 })).Methods(http.MethodPatch) | 183 })).Methods(http.MethodPatch) |
183 | 184 |
184 api.Handle("/imports/scheduler/{id:[0-9]+}", | 185 api.Handle("/imports/config/{id:[0-9]+}", |
185 waterwayAdmin(&JSONHandler{ | 186 waterwayAdmin(&JSONHandler{ |
186 Handle: deleteSchedule, | 187 Handle: deleteImportConfig, |
187 })).Methods(http.MethodDelete) | 188 })).Methods(http.MethodDelete) |
188 | 189 |
189 api.Handle("/imports/scheduler/{id:[0-9]+}", | 190 api.Handle("/imports/config/{id:[0-9]+}", |
190 waterwayAdmin(&JSONHandler{ | 191 waterwayAdmin(&JSONHandler{ |
191 Handle: infoSchedule, | 192 Handle: infoImportConfig, |
192 })).Methods(http.MethodGet) | 193 })).Methods(http.MethodGet) |
193 | 194 |
194 api.Handle("/imports/scheduler", | 195 api.Handle("/imports/config", |
195 waterwayAdmin(&JSONHandler{ | 196 waterwayAdmin(&JSONHandler{ |
196 Input: func() interface{} { return new(models.ImportConfig) }, | 197 Input: func() interface{} { return new(imports.Config) }, |
197 Handle: addSchedule, | 198 Handle: addImportConfig, |
198 })).Methods(http.MethodPost) | 199 })).Methods(http.MethodPost) |
199 | 200 |
200 api.Handle("/imports/scheduler", | 201 api.Handle("/imports/config", |
201 waterwayAdmin(&JSONHandler{ | 202 waterwayAdmin(&JSONHandler{ |
202 Handle: listScheduler, | 203 Handle: listImportConfigs, |
203 })).Methods(http.MethodGet) | 204 })).Methods(http.MethodGet) |
204 | 205 |
205 // Import queue | 206 // Import queue |
206 lsImports := waterwayAdmin(&JSONHandler{ | 207 lsImports := waterwayAdmin(&JSONHandler{ |
207 Handle: listImports, | 208 Handle: listImports, |