mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 11:58:02 +00:00
fbc75d89b2
* 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>
114 lines
2.7 KiB
Go
114 lines
2.7 KiB
Go
package org
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore/v2"
|
|
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
|
"github.com/caos/zitadel/internal/v2/repository/policy"
|
|
)
|
|
|
|
var (
|
|
MailTextAddedEventType = orgEventTypePrefix + policy.MailTextPolicyAddedEventType
|
|
MailTextChangedEventType = orgEventTypePrefix + policy.MailTextPolicyChangedEventType
|
|
MailTextRemovedEventType = orgEventTypePrefix + policy.MailTextPolicyRemovedEventType
|
|
)
|
|
|
|
type MailTextAddedEvent struct {
|
|
policy.MailTextAddedEvent
|
|
}
|
|
|
|
func NewMailTextAddedEvent(
|
|
ctx context.Context,
|
|
resourceOwner,
|
|
mailTextType,
|
|
language,
|
|
title,
|
|
preHeader,
|
|
subject,
|
|
greeting,
|
|
text,
|
|
buttonText string,
|
|
) *MailTextAddedEvent {
|
|
return &MailTextAddedEvent{
|
|
MailTextAddedEvent: *policy.NewMailTextAddedEvent(
|
|
eventstore.NewBaseEventForPushWithResourceOwner(ctx, MailTextAddedEventType, resourceOwner),
|
|
mailTextType,
|
|
language,
|
|
title,
|
|
preHeader,
|
|
subject,
|
|
greeting,
|
|
text,
|
|
buttonText),
|
|
}
|
|
}
|
|
|
|
func MailTextAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := policy.MailTextAddedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &MailTextAddedEvent{MailTextAddedEvent: *e.(*policy.MailTextAddedEvent)}, nil
|
|
}
|
|
|
|
type MailTextChangedEvent struct {
|
|
policy.MailTextChangedEvent
|
|
}
|
|
|
|
func NewMailTextChangedEvent(
|
|
ctx context.Context,
|
|
mailTextType,
|
|
language string,
|
|
changes []policy.MailTextChanges,
|
|
) (*MailTextChangedEvent, error) {
|
|
changedEvent, err := policy.NewMailTextChangedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, MailTextChangedEventType),
|
|
mailTextType,
|
|
language,
|
|
changes,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &MailTextChangedEvent{MailTextChangedEvent: *changedEvent}, nil
|
|
}
|
|
|
|
func MailTextChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := policy.MailTextChangedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &MailTextChangedEvent{MailTextChangedEvent: *e.(*policy.MailTextChangedEvent)}, nil
|
|
}
|
|
|
|
type MailTextRemovedEvent struct {
|
|
policy.MailTextRemovedEvent
|
|
}
|
|
|
|
func NewMailTextRemovedEvent(
|
|
ctx context.Context,
|
|
resourceOwner,
|
|
mailTextType,
|
|
language string,
|
|
) *MailTextRemovedEvent {
|
|
return &MailTextRemovedEvent{
|
|
MailTextRemovedEvent: *policy.NewMailTextRemovedEvent(
|
|
eventstore.NewBaseEventForPushWithResourceOwner(ctx, MailTextRemovedEventType, resourceOwner),
|
|
mailTextType,
|
|
language,
|
|
),
|
|
}
|
|
}
|
|
|
|
func MailTextRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e, err := policy.MailTextRemovedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &MailTextRemovedEvent{MailTextRemovedEvent: *e.(*policy.MailTextRemovedEvent)}, nil
|
|
}
|