comparison pkg/controllers/routes.go @ 2042:d29ac997eb34 unify_imports

This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 25 Jan 2019 16:07:09 +0100
parents f1e32babb587
children 09f9ae3d0526
comparison
equal deleted inserted replaced
2041:d61ca2b3fc12 2042:d29ac997eb34
13 // * Sascha Wilde <sascha.wilde@intevation.de> 13 // * Sascha Wilde <sascha.wilde@intevation.de>
14 14
15 package controllers 15 package controllers
16 16
17 import ( 17 import (
18 "encoding/json"
18 "net/http" 19 "net/http"
19 "net/http/httputil" 20 "net/http/httputil"
20 21
21 "github.com/gorilla/mux" 22 "github.com/gorilla/mux"
22 23
241 Handle: runImportConfig, 242 Handle: runImportConfig,
242 })).Methods(http.MethodGet) 243 })).Methods(http.MethodGet)
243 244
244 api.Handle("/imports/config/{id:[0-9]+}", 245 api.Handle("/imports/config/{id:[0-9]+}",
245 waterwayAdmin(&JSONHandler{ 246 waterwayAdmin(&JSONHandler{
246 Input: func() interface{} { return new(imports.Config) }, 247 Input: func() interface{} { return &json.RawMessage{} },
247 Handle: modifyImportConfig, 248 Handle: modifyImportConfig,
248 })).Methods(http.MethodPatch) 249 })).Methods(http.MethodPatch)
249 250
250 api.Handle("/imports/config/{id:[0-9]+}", 251 api.Handle("/imports/config/{id:[0-9]+}",
251 waterwayAdmin(&JSONHandler{ 252 waterwayAdmin(&JSONHandler{
257 Handle: infoImportConfig, 258 Handle: infoImportConfig,
258 })).Methods(http.MethodGet) 259 })).Methods(http.MethodGet)
259 260
260 api.Handle("/imports/config", 261 api.Handle("/imports/config",
261 waterwayAdmin(&JSONHandler{ 262 waterwayAdmin(&JSONHandler{
262 Input: func() interface{} { return new(imports.Config) }, 263 Input: func() interface{} { return new(imports.ImportConfigIn) },
263 Handle: addImportConfig, 264 Handle: addImportConfig,
264 })).Methods(http.MethodPost) 265 })).Methods(http.MethodPost)
265 266
266 api.Handle("/imports/config", 267 api.Handle("/imports/config",
267 waterwayAdmin(&JSONHandler{ 268 waterwayAdmin(&JSONHandler{