changeset 4911:bcb8b69e4358 fairway-marks-import

Type specific names for fairway marks import
author Tom Gottfried <tom@intevation.de>
date Mon, 10 Feb 2020 18:02:22 +0100
parents ab184888d58b
children bfd8ef836998
files pkg/controllers/routes.go pkg/imports/fm_bcnlat.go pkg/imports/modelconvert.go
diffstat 3 files changed, 21 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/routes.go	Mon Feb 10 17:07:18 2020 +0100
+++ b/pkg/controllers/routes.go	Mon Feb 10 18:02:22 2020 +0100
@@ -241,8 +241,9 @@
 
 	kinds := strings.Join([]string{
 		"bn", "gm", "fa", "wx", "wa",
-		"wg", "dmv", "fd", "dma", "fm",
+		"wg", "dmv", "fd", "dma",
 		"sec", "dsec", "dst", "dsr",
+		"fm_bcnlat",
 	}, "|")
 
 	api.Handle("/imports/{kind:"+kinds+"}", waterwayAdmin(&mw.JSONHandler{
--- a/pkg/imports/fm_bcnlat.go	Mon Feb 10 17:07:18 2020 +0100
+++ b/pkg/imports/fm_bcnlat.go	Mon Feb 10 18:02:22 2020 +0100
@@ -34,13 +34,13 @@
 	return bcnlat.URL + "|" + bcnlat.FeatureType, nil
 }
 
-// FMJobKind is the import queue type identifier.
-const FMJobKind JobKind = "fm"
+// BCNLATJobKind is the import queue type identifier.
+const BCNLATJobKind JobKind = "fm_bcnlat"
 
 type bcnlatJobCreator struct{}
 
 func init() {
-	RegisterJobCreator(FMJobKind, bcnlatJobCreator{})
+	RegisterJobCreator(BCNLATJobKind, bcnlatJobCreator{})
 }
 
 func (bcnlatJobCreator) Description() string { return "fairway marks bcnlat" }
--- a/pkg/imports/modelconvert.go	Mon Feb 10 17:07:18 2020 +0100
+++ b/pkg/imports/modelconvert.go	Mon Feb 10 18:02:22 2020 +0100
@@ -18,21 +18,21 @@
 )
 
 var kindToImportModel = map[JobKind]func() interface{}{
-	BNJobKind:   func() interface{} { return new(models.BottleneckImport) },
-	GMJobKind:   func() interface{} { return new(models.GaugeMeasurementImport) },
-	FAJobKind:   func() interface{} { return new(models.FairwayAvailabilityImport) },
-	WXJobKind:   func() interface{} { return new(models.WaterwayAxisImport) },
-	WAJobKind:   func() interface{} { return new(models.WaterwayAreaImport) },
-	WGJobKind:   func() interface{} { return new(models.WaterwayGaugeImport) },
-	DMVJobKind:  func() interface{} { return new(models.DistanceMarksVirtualImport) },
-	FDJobKind:   func() interface{} { return new(models.FairwayDimensionImport) },
-	DMAJobKind:  func() interface{} { return new(models.DistanceMarksAshoreImport) },
-	FMJobKind:   func() interface{} { return new(models.FairwayMarksImport) },
-	STJobKind:   func() interface{} { return new(models.StretchImport) },
-	SECJobKind:  func() interface{} { return new(models.SectionImport) },
-	DSECJobKind: func() interface{} { return new(models.SectionDelete) },
-	DSTJobKind:  func() interface{} { return new(models.StretchDelete) },
-	DSRJobKind:  func() interface{} { return new(models.SoundingResultDelete) },
+	BNJobKind:     func() interface{} { return new(models.BottleneckImport) },
+	GMJobKind:     func() interface{} { return new(models.GaugeMeasurementImport) },
+	FAJobKind:     func() interface{} { return new(models.FairwayAvailabilityImport) },
+	WXJobKind:     func() interface{} { return new(models.WaterwayAxisImport) },
+	WAJobKind:     func() interface{} { return new(models.WaterwayAreaImport) },
+	WGJobKind:     func() interface{} { return new(models.WaterwayGaugeImport) },
+	DMVJobKind:    func() interface{} { return new(models.DistanceMarksVirtualImport) },
+	FDJobKind:     func() interface{} { return new(models.FairwayDimensionImport) },
+	DMAJobKind:    func() interface{} { return new(models.DistanceMarksAshoreImport) },
+	BCNLATJobKind: func() interface{} { return new(models.FairwayMarksImport) },
+	STJobKind:     func() interface{} { return new(models.StretchImport) },
+	SECJobKind:    func() interface{} { return new(models.SectionImport) },
+	DSECJobKind:   func() interface{} { return new(models.SectionDelete) },
+	DSTJobKind:    func() interface{} { return new(models.StretchDelete) },
+	DSRJobKind:    func() interface{} { return new(models.SoundingResultDelete) },
 }
 
 // ImportModelForJobKind returns the constructor function to
@@ -137,7 +137,7 @@
 		}
 	},
 
-	FMJobKind: func(input interface{}) interface{} {
+	BCNLATJobKind: func(input interface{}) interface{} {
 		fmi := input.(*models.FairwayMarksImport)
 		return &FairwayMarks{
 			URL:         fmi.URL,