Mercurial > gemma
changeset 2032:15db4fb07af4 unify_imports
merge
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 25 Jan 2019 10:15:53 +0100 |
parents | 4c33bac70a11 (current diff) 83108e90b223 (diff) |
children | 431f97fd873b |
files | |
diffstat | 3 files changed, 22 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/manualimports.go Fri Jan 25 10:15:29 2019 +0100 +++ b/pkg/controllers/manualimports.go Fri Jan 25 10:15:53 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 10:15:29 2019 +0100 +++ b/pkg/models/importbase.go Fri Jan 25 10:15:53 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 } @@ -56,6 +64,10 @@ return ut } +func (et *EmailType) GetEmailType() *EmailType { + return et +} + // UnmarshalJSON checks if the incoming string is a valid cron line. func (cs *CronSpec) UnmarshalJSON(data []byte) error { var spec string