mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 19:44:21 +00:00
b5564572bc
This implementation increases parallel write capabilities of the eventstore. Please have a look at the technical advisories: [05](https://zitadel.com/docs/support/advisory/a10005) and [06](https://zitadel.com/docs/support/advisory/a10006). The implementation of eventstore.push is rewritten and stored events are migrated to a new table `eventstore.events2`. If you are using cockroach: make sure that the database user of ZITADEL has `VIEWACTIVITY` grant. This is used to query events.
85 lines
1.9 KiB
Go
85 lines
1.9 KiB
Go
package instance
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
"github.com/zitadel/zitadel/internal/repository/policy"
|
|
)
|
|
|
|
var (
|
|
MailTextAddedEventType = instanceEventTypePrefix + policy.MailTextPolicyAddedEventType
|
|
MailTextChangedEventType = instanceEventTypePrefix + policy.MailTextPolicyChangedEventType
|
|
)
|
|
|
|
type MailTextAddedEvent struct {
|
|
policy.MailTextAddedEvent
|
|
}
|
|
|
|
func NewMailTextAddedEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
mailTextType,
|
|
language,
|
|
title,
|
|
preHeader,
|
|
subject,
|
|
greeting,
|
|
text,
|
|
buttonText string,
|
|
) *MailTextAddedEvent {
|
|
return &MailTextAddedEvent{
|
|
MailTextAddedEvent: *policy.NewMailTextAddedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, MailTextAddedEventType),
|
|
mailTextType,
|
|
language,
|
|
title,
|
|
preHeader,
|
|
subject,
|
|
greeting,
|
|
text,
|
|
buttonText),
|
|
}
|
|
}
|
|
|
|
func MailTextAddedEventMapper(event eventstore.Event) (eventstore.Event, 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,
|
|
aggregate *eventstore.Aggregate,
|
|
mailTextType,
|
|
language string,
|
|
changes []policy.MailTextChanges,
|
|
) (*MailTextChangedEvent, error) {
|
|
changedEvent, err := policy.NewMailTextChangedEvent(
|
|
eventstore.NewBaseEventForPush(ctx, aggregate, MailTextChangedEventType),
|
|
mailTextType,
|
|
language,
|
|
changes,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &MailTextChangedEvent{MailTextChangedEvent: *changedEvent}, nil
|
|
}
|
|
|
|
func MailTextChangedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := policy.MailTextChangedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &MailTextChangedEvent{MailTextChangedEvent: *e.(*policy.MailTextChangedEvent)}, nil
|
|
}
|