changeset 5184:445daeefca7b new-fwa

Added controller stub for new fairway availability.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 23 Mar 2020 15:29:55 +0100
parents 56c589f7435d
children 3c748b2b4de6
files pkg/controllers/fwa.go pkg/controllers/routes.go
diffstat 2 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pkg/controllers/fwa.go	Mon Mar 23 15:29:55 2020 +0100
@@ -0,0 +1,33 @@
+// This is Free Software under GNU Affero General Public License v >= 3.0
+// without warranty, see README.md and license for details.
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// License-Filename: LICENSES/AGPL-3.0.txt
+//
+// Copyright (C) 2018, 2019, 2020 by via donau
+//   – Österreichische Wasserstraßen-Gesellschaft mbH
+// Software engineering by Intevation GmbH
+//
+// Author(s):
+//  * Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+package controllers
+
+import (
+	"net/http"
+
+	"github.com/gorilla/mux"
+)
+
+func fairwayAvailability(res http.ResponseWriter, req *http.Request) {
+
+	vars := mux.Vars(req)
+
+	switch vars["kind"] {
+	case "bottleneck":
+	case "stretch":
+	case "section":
+	}
+
+	// TODO: Implement me!
+}
--- a/pkg/controllers/routes.go	Fri Mar 20 17:24:03 2020 +0100
+++ b/pkg/controllers/routes.go	Mon Mar 23 15:29:55 2020 +0100
@@ -329,6 +329,9 @@
 
 	// Handler to serve data to the client.
 
+	api.Handle("/data/{kind:stretch|section|bottleneck}/fairway/{name:.+}", any(
+		mw.DBConn(http.HandlerFunc(fairwayAvailability)))).Methods(http.MethodGet)
+
 	api.Handle("/data/stretch/shape/{name:.+}", any(
 		mw.DBConn(http.HandlerFunc(stretchShapeDownload)))).Methods(http.MethodGet)