Mercurial > gemma
changeset 1677:53304db85888
Waterway axis import: Added route for manual import.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 26 Dec 2018 10:46:17 +0100 |
parents | 4407ecaa2192 |
children | 8fdb57173e3f |
files | pkg/controllers/manualimports.go pkg/controllers/routes.go pkg/imports/wx.go pkg/models/waterway.go |
diffstat | 4 files changed, 40 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/manualimports.go Wed Dec 26 10:30:19 2018 +0100 +++ b/pkg/controllers/manualimports.go Wed Dec 26 10:46:17 2018 +0100 @@ -52,6 +52,16 @@ return fa, fai.SendEmail, true } +func importWaterwayAxis(input interface{}) (interface{}, bool, bool) { + wxi := input.(*models.WaterwayAxisImport) + wx := &imports.WaterwayAxis{ + URL: wxi.URL, + FeatureType: wxi.FeatureType, + SortBy: wxi.SortBy, + } + return wx, wxi.SendEmail, true +} + func manualImport( kind imports.JobKind, setup func(interface{}) (interface{}, bool, bool),
--- a/pkg/controllers/routes.go Wed Dec 26 10:30:19 2018 +0100 +++ b/pkg/controllers/routes.go Wed Dec 26 10:46:17 2018 +0100 @@ -189,6 +189,12 @@ NoConn: true, })).Methods(http.MethodPost) + api.Handle("/imports/waterwayaxis", waterwayAdmin(&JSONHandler{ + Input: func() interface{} { return new(models.WaterwayAxisImport) }, + Handle: manualImport(imports.WXJobKind, importWaterwayAxis), + NoConn: true, + })).Methods(http.MethodPost) + // Import scheduler configuration api.Handle("/imports/config/{id:[0-9]+}", waterwayAdmin(&JSONHandler{
--- a/pkg/imports/wx.go Wed Dec 26 10:30:19 2018 +0100 +++ b/pkg/imports/wx.go Wed Dec 26 10:46:17 2018 +0100 @@ -21,8 +21,9 @@ ) type WaterwayAxis struct { - URL string `json:"url"` - SortBy string `json:"sort-by"` + URL string `json:"url"` + FeatureType string `json:"feature-type"` + SortBy string `json:"sort-by"` } const WXJobKind JobKind = "wx"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/models/waterway.go Wed Dec 26 10:46:17 2018 +0100 @@ -0,0 +1,21 @@ +// 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 by via donau +// – Österreichische Wasserstraßen-Gesellschaft mbH +// Software engineering by Intevation GmbH +// +// Author(s): +// * Sascha L. Teichmann <sascha.teichmann@intevation.de> + +package models + +type WaterwayAxisImport struct { + URL string `json:"url"` + FeatureType string `json:"feature-type"` + SortBy string `json:"sort-by"` + SendEmail bool `json:"send-email"` +}