mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
8dcbbc87ca
* fix: adaot config to commands (and queries) * remove dependency on vv2 in v1 * add queries user to operator * set password for queries on tests * set password for queries on tests * fix config
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package command
|
|
|
|
import (
|
|
"context"
|
|
"github.com/caos/logging"
|
|
"github.com/caos/zitadel/internal/domain"
|
|
"github.com/caos/zitadel/internal/eventstore"
|
|
)
|
|
|
|
type Step10 struct {
|
|
DefaultMailTemplate domain.MailTemplate
|
|
DefaultMailTexts []domain.MailText
|
|
}
|
|
|
|
func (s *Step10) Step() domain.Step {
|
|
return domain.Step10
|
|
}
|
|
|
|
func (s *Step10) execute(ctx context.Context, commandSide *Commands) error {
|
|
return commandSide.SetupStep10(ctx, s)
|
|
}
|
|
|
|
func (c *Commands) SetupStep10(ctx context.Context, step *Step10) error {
|
|
fn := func(iam *IAMWriteModel) ([]eventstore.EventPusher, error) {
|
|
iamAgg := IAMAggregateFromWriteModel(&iam.WriteModel)
|
|
mailTemplateEvent, err := c.addDefaultMailTemplate(ctx, iamAgg, NewIAMMailTemplateWriteModel(), &step.DefaultMailTemplate)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
events := []eventstore.EventPusher{
|
|
mailTemplateEvent,
|
|
}
|
|
for _, text := range step.DefaultMailTexts {
|
|
defaultTextEvent, err := c.addDefaultMailText(ctx, iamAgg, NewIAMMailTextWriteModel(text.MailTextType, text.Language), &text)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
events = append(events, defaultTextEvent)
|
|
}
|
|
logging.Log("SETUP-3N9fs").Info("default mail template/text set up")
|
|
return events, nil
|
|
}
|
|
return c.setup(ctx, step, fn)
|
|
}
|