mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
9d4f296c62
* fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename iam command side to instance * fix: rename orgiampolicy to domain policy * fix: merge conflicts * fix: protos * fix: md files * implement deprecated org iam policy again Co-authored-by: Livio Amstutz <livio.a@gmail.com>
68 lines
1.8 KiB
Go
68 lines
1.8 KiB
Go
package instance
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore"
|
|
"github.com/caos/zitadel/internal/eventstore/repository"
|
|
"github.com/caos/zitadel/internal/repository/policy"
|
|
)
|
|
|
|
var (
|
|
MailTemplateAddedEventType = instanceEventTypePrefix + policy.MailTemplatePolicyAddedEventType
|
|
MailTemplateChangedEventType = instanceEventTypePrefix + policy.MailTemplatePolicyChangedEventType
|
|
)
|
|
|
|
type MailTemplateAddedEvent struct {
|
|
policy.MailTemplateAddedEvent
|
|
}
|
|
|
|
func NewMailTemplateAddedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
template []byte,
|
|
) *MailTemplateAddedEvent {
|
|
return &MailTemplateAddedEvent{
|
|
MailTemplateAddedEvent: *policy.NewMailTemplateAddedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, MailTemplateAddedEventType),
|
|
template),
|
|
}
|
|
}
|
|
|
|
func MailTemplateAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
|
e, err := policy.MailTemplateAddedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &MailTemplateAddedEvent{MailTemplateAddedEvent: *e.(*policy.MailTemplateAddedEvent)}, nil
|
|
}
|
|
|
|
type MailTemplateChangedEvent struct {
|
|
policy.MailTemplateChangedEvent
|
|
}
|
|
|
|
func NewMailTemplateChangedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
changes []policy.MailTemplateChanges,
|
|
) (*MailTemplateChangedEvent, error) {
|
|
changedEvent, err := policy.NewMailTemplateChangedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, MailTemplateChangedEventType),
|
|
changes,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &MailTemplateChangedEvent{MailTemplateChangedEvent: *changedEvent}, nil
|
|
}
|
|
|
|
func MailTemplateChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
|
e, err := policy.MailTemplateChangedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &MailTemplateChangedEvent{MailTemplateChangedEvent: *e.(*policy.MailTemplateChangedEvent)}, nil
|
|
}
|