changeset 2029:8d006afa7c1b unify_imports

Imports: Stretch imports are not configurabel and scheduable.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 25 Jan 2019 09:55:56 +0100
parents a8d8e855cb26
children 83108e90b223
files pkg/controllers/manualimports.go pkg/models/importbase.go pkg/models/imports.go
diffstat 3 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/manualimports.go	Fri Jan 25 09:42:43 2019 +0100
+++ b/pkg/controllers/manualimports.go	Fri Jan 25 09:55:56 2019 +0100
@@ -159,7 +159,10 @@
 			}
 			trys = qct.Trys
 			waitRetry = qct.WaitRetry
-			email = qct.EMail
+		}
+
+		if etg, ok := input.(models.EmailTypeGetter); ok {
+			email = etg.GetEmailType().Email
 		}
 
 		session, _ := auth.GetSession(req)
--- a/pkg/models/importbase.go	Fri Jan 25 09:42:43 2019 +0100
+++ b/pkg/models/importbase.go	Fri Jan 25 09:55:56 2019 +0100
@@ -24,16 +24,16 @@
 	// CronSpec is a string containing a cron line.
 	CronSpec string
 
+	EmailType struct {
+		Email bool `json:"send-email,omitempty"`
+	}
+
 	QueueConfigurationType struct {
+		EmailType
 		Trys      *int           `json:"trys,omitempty"`
 		WaitRetry *time.Duration `json:"wait-retry,omitempty"`
 		Due       *time.Time     `json:"due,omitempty"`
 		Cron      *CronSpec      `json:"cron,omitempty"`
-		EMail     bool           `json:"send-email,omitempty"`
-	}
-
-	QueueConfigurationGetter interface {
-		GetQueueConfiguration() *QueueConfigurationType
 	}
 
 	URLType struct {
@@ -43,6 +43,14 @@
 		Password *string `json:"password,omitempty"`
 	}
 
+	EmailTypeGetter interface {
+		GetEmailType() *EmailType
+	}
+
+	QueueConfigurationGetter interface {
+		GetQueueConfiguration() *QueueConfigurationType
+	}
+
 	URLTypeGetter interface {
 		GetURLType() *URLType
 	}
--- a/pkg/models/imports.go	Fri Jan 25 09:42:43 2019 +0100
+++ b/pkg/models/imports.go	Fri Jan 25 09:55:56 2019 +0100
@@ -97,7 +97,7 @@
 	}
 
 	StretchImport struct {
-		QueueConfigurationType
+		EmailType
 
 		Name      string          `json:"name"`
 		From      Isrs            `json:"from"`