changeset 5190:c3765d8e2a90 new-fwa

Merged default into new-fwa branch.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 02 Apr 2020 19:06:52 +0200
parents 5c52d6d69545 (diff) e688e79a51e8 (current diff)
children f5564dc0adcc
files
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	Thu Apr 02 19:06:52 2020 +0200
@@ -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	Thu Apr 02 16:12:24 2020 +0200
+++ b/pkg/controllers/routes.go	Thu Apr 02 19:06:52 2020 +0200
@@ -324,6 +324,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)