feat: mail tempaltes/texts and step 10 (#1266)

* feat: mail template/text events

* feat: mail template/text events

* feat: mail template/text on iam and org

* feat: setup step 10

* fix: add template event

* fix: add unique constraints

* Update internal/static/i18n/de.yaml

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/static/i18n/de.yaml

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/static/i18n/de.yaml

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/static/i18n/de.yaml

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/v2/command/iam_policy_mail_template.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/v2/command/org_policy_mail_text.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/v2/command/iam_policy_mail_template.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/v2/command/iam_policy_mail_text.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/v2/command/iam_policy_mail_text.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/v2/command/org_policy_mail_template.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/v2/command/org_policy_mail_template.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/v2/command/org_policy_mail_text.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* fix: org iam policy

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2021-02-10 10:48:40 +01:00
committed by GitHub
parent b0bcc13a92
commit fbc75d89b2
48 changed files with 1689 additions and 287 deletions

View File

@@ -1,98 +0,0 @@
package setup
//
//type Step10 struct {
// DefaultMailTemplate iam_model.MailTemplate
// DefaultMailTexts []iam_model.MailText
//
// setup *Setup
//}
//
//func (s *Step10) isNil() bool {
// return s == nil
//}
//
//func (step *Step10) step() iam_model.Step {
// return iam_model.Step10
//}
//
//func (step *Step10) init(setup *Setup) {
// step.setup = setup
//}
//
//func (step *Step10) execute(ctx context.Context) (*iam_model.IAM, error) {
// iam, agg, err := step.mailTemplate(ctx, &step.DefaultMailTemplate)
// if err != nil {
// logging.Log("SETUP-1UYCt").WithField("step", step.step()).WithError(err).Error("unable to finish setup (Mail template)")
// return nil, err
// }
// iam, agg, push, err := step.setup.IamEvents.PrepareSetupDone(ctx, iam, agg, step.step())
// if err != nil {
// logging.Log("SETUP-fMLsb").WithField("step", step.step()).WithError(err).Error("unable to finish setup (prepare setup done)")
// return nil, err
// }
// err = es_sdk.PushAggregates(ctx, push, iam.AppendEvents, agg)
// if err != nil {
// logging.Log("SETUP-GuS3f").WithField("step", step.step()).WithError(err).Error("unable to finish setup")
// return nil, err
// }
//
// iam, agg, err = step.defaultMailTexts(ctx, &step.DefaultMailTexts)
// if err != nil {
// logging.Log("SETUP-p4oWq").WithError(err).Error("unable to set up defaultMailTexts")
// return nil, err
// }
// iam, agg, push, err = step.setup.IamEvents.PrepareSetupDone(ctx, iam, agg, step.step())
// if err != nil {
// logging.Log("SETUP-fMLsb").WithField("step", step.step()).WithError(err).Error("unable to finish setup (prepare setup done)")
// return nil, err
// }
// err = es_sdk.PushAggregates(ctx, push, iam.AppendEvents, agg)
// if err != nil {
// logging.Log("SETUP-GuS3f").WithField("step", step.step()).WithError(err).Error("unable to finish setup")
// return nil, err
// }
//
// return iam_es_model.IAMToModel(iam), nil
//}
//
//func (step *Step10) mailTemplate(ctx context.Context, mailTemplate *iam_model.MailTemplate) (*iam_es_model.IAM, *models.Aggregate, error) {
// logging.Log("SETUP-cNrF3").Info("setting up mail template")
// mailTemplate.AggregateID = step.setup.iamID
// iam, aggregate, err := step.setup.IamEvents.PrepareAddMailTemplate(ctx, mailTemplate)
// if err != nil {
// return nil, nil, err
// }
// return iam, aggregate, nil
//}
//
//func (step *Step10) defaultMailTexts(ctx context.Context, defaultMailTexts *[]iam_model.MailText) (*iam_es_model.IAM, *models.Aggregate, error) {
// logging.Log("SETUP-dsTh3").Info("setting up defaultMailTexts")
// iam := &iam_es_model.IAM{}
// var aggregate *models.Aggregate
// for index, iamDefaultMailText := range *defaultMailTexts {
// iaml, aggregatel, err := step.defaultMailText(ctx, &iamDefaultMailText)
// if err != nil {
// logging.LogWithFields("SETUP-IlLif", "DefaultMailText", iamDefaultMailText.MailTextType).WithError(err).Error("unable to create defaultMailText")
// return nil, nil, err
// }
// if index == 0 {
// aggregate = aggregatel
// } else {
// aggregate.Events = append(aggregate.Events, aggregatel.Events...)
// }
// iam = iaml
// }
// logging.Log("SETUP-dgjT4").Info("defaultMailTexts set up")
// return iam, aggregate, nil
//}
//
//func (step *Step10) defaultMailText(ctx context.Context, mailText *iam_model.MailText) (*iam_es_model.IAM, *models.Aggregate, error) {
// logging.Log("SETUP-cNrF3").Info("setting up mail text")
// mailText.AggregateID = step.setup.iamID
// iam, aggregate, err := step.setup.IamEvents.PrepareAddMailText(ctx, mailText)
// if err != nil {
// return nil, nil, err
// }
// return iam, aggregate, nil
//}