mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
45 lines
1000 B
Go
45 lines
1000 B
Go
package iam
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore"
|
|
"github.com/caos/zitadel/internal/eventstore/repository"
|
|
"github.com/caos/zitadel/internal/repository/features"
|
|
)
|
|
|
|
var (
|
|
FeaturesSetEventType = iamEventTypePrefix + features.FeaturesSetEventType
|
|
)
|
|
|
|
type FeaturesSetEvent struct {
|
|
features.FeaturesSetEvent
|
|
}
|
|
|
|
func NewFeaturesSetEvent(
|
|
ctx context.Context,
|
|
aggregate *eventstore.Aggregate,
|
|
changes []features.FeaturesChanges,
|
|
) (*FeaturesSetEvent, error) {
|
|
changedEvent, err := features.NewFeaturesSetEvent(
|
|
eventstore.NewBaseEventForPush(
|
|
ctx,
|
|
aggregate,
|
|
FeaturesSetEventType),
|
|
changes,
|
|
)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &FeaturesSetEvent{FeaturesSetEvent: *changedEvent}, nil
|
|
}
|
|
|
|
func FeaturesSetEventMapper(event *repository.Event) (eventstore.Event, error) {
|
|
e, err := features.FeaturesSetEventMapper(event)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &FeaturesSetEvent{FeaturesSetEvent: *e.(*features.FeaturesSetEvent)}, nil
|
|
}
|