mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 04:18:01 +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.
63 lines
1.5 KiB
Go
63 lines
1.5 KiB
Go
package user
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
"github.com/zitadel/zitadel/internal/repository/asset"
|
|
)
|
|
|
|
const (
|
|
avatarEventPrefix = humanEventPrefix + "avatar."
|
|
HumanAvatarAddedType = avatarEventPrefix + "added"
|
|
HumanAvatarRemovedType = avatarEventPrefix + "removed"
|
|
)
|
|
|
|
type HumanAvatarAddedEvent struct {
|
|
asset.AddedEvent
|
|
}
|
|
|
|
func NewHumanAvatarAddedEvent(ctx context.Context, aggregate *eventstore.Aggregate, storageKey string) *HumanAvatarAddedEvent {
|
|
return &HumanAvatarAddedEvent{
|
|
AddedEvent: *asset.NewAddedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
HumanAvatarAddedType),
|
|
storageKey),
|
|
}
|
|
}
|
|
|
|
func HumanAvatarAddedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := asset.AddedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &HumanAvatarAddedEvent{AddedEvent: *e.(*asset.AddedEvent)}, nil
|
|
}
|
|
|
|
type HumanAvatarRemovedEvent struct {
|
|
asset.RemovedEvent
|
|
}
|
|
|
|
func NewHumanAvatarRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, storageKey string) *HumanAvatarRemovedEvent {
|
|
return &HumanAvatarRemovedEvent{
|
|
RemovedEvent: *asset.NewRemovedEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
HumanAvatarRemovedType),
|
|
storageKey),
|
|
}
|
|
}
|
|
|
|
func HumanAvatarRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
|
e, err := asset.RemovedEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &HumanAvatarRemovedEvent{RemovedEvent: *e.(*asset.RemovedEvent)}, nil
|
|
}
|