Mercurial > gemma
changeset 2019:aeff01c6edec unify_imports
Moved fairwayavailability to a local model.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 24 Jan 2019 17:26:30 +0100 |
parents | 8a62ce2a5c70 |
children | 491084efd15c |
files | pkg/imports/fa.go pkg/models/fa.go pkg/models/imports.go |
diffstat | 3 files changed, 18 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/fa.go Thu Jan 24 17:21:14 2019 +0100 +++ b/pkg/imports/fa.go Thu Jan 24 17:26:30 2019 +0100 @@ -22,7 +22,6 @@ "github.com/jackc/pgx/pgtype" "gemma.intevation.de/gemma/pkg/common" - "gemma.intevation.de/gemma/pkg/models" "gemma.intevation.de/gemma/pkg/soap/ifaf" ) @@ -36,6 +35,11 @@ Insecure bool `json:"insecure"` } +type uniqueFairwayAvailability struct { + BottleneckId string + Surdat time.Time +} + // FAJobKind is import queue type identifier. const FAJobKind JobKind = "fa" @@ -225,7 +229,7 @@ if err != nil { return nil, err } - fairwayAvailabilities := map[models.UniqueFairwayAvailability]int64{} + fairwayAvailabilities := map[uniqueFairwayAvailability]int64{} for faRows.Next() { var id int64 var bnId string @@ -237,7 +241,7 @@ ); err != nil { return nil, err } - key := models.UniqueFairwayAvailability{ + key := uniqueFairwayAvailability{ BottleneckId: bnId, Surdat: sd, } @@ -280,7 +284,7 @@ func (fa *FairwayAvailability) doForFAs( ctx context.Context, bottlenecks []bottleneckCountry, - fairwayAvailabilities map[models.UniqueFairwayAvailability]int64, + fairwayAvailabilities map[uniqueFairwayAvailability]int64, latestDate pgtype.Timestamp, conn *sql.Conn, feedback Feedback, @@ -349,7 +353,7 @@ var faID int64 feedback.Info("Found %d fairway availabilities", len(result.FairwayAvailability)) for _, faRes := range result.FairwayAvailability { - uniqueFa := models.UniqueFairwayAvailability{ + uniqueFa := uniqueFairwayAvailability{ BottleneckId: faRes.Bottleneck_id, Surdat: faRes.SURDAT, }
--- a/pkg/models/fa.go Thu Jan 24 17:21:14 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -// 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): -// * Raimund Renkert <raimund.renkert@intevation.de> - -package models - -import ( - "time" - - "gemma.intevation.de/gemma/pkg/common" -) - -// FairwayAvailabilityImport contains data used to define the endpoint -type FairwayAvailabilityImport struct { - URL string `json:"url"` - Insecure bool `json:"insecure"` - SendEmail bool `json:"send-email"` - // Attributes are optional attributes. - Attributes common.Attributes `json:"attributes,omitempty"` -} - -type UniqueFairwayAvailability struct { - BottleneckId string - Surdat time.Time -}
--- a/pkg/models/imports.go Thu Jan 24 17:21:14 2019 +0100 +++ b/pkg/models/imports.go Thu Jan 24 17:26:30 2019 +0100 @@ -29,3 +29,12 @@ // Attributes are optional attributes. Attributes common.Attributes `json:"attributes,omitempty"` } + +// FairwayAvailabilityImport contains data used to define the endpoint +type FairwayAvailabilityImport struct { + URL string `json:"url"` + Insecure bool `json:"insecure"` + SendEmail bool `json:"send-email"` + // Attributes are optional attributes. + Attributes common.Attributes `json:"attributes,omitempty"` +}