mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
fa9f581d56
* chore: move to new org * logging * fix: org rename caos -> zitadel Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
45 lines
1019 B
Go
45 lines
1019 B
Go
package instance
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
"github.com/zitadel/zitadel/internal/eventstore/repository"
|
|
"github.com/zitadel/zitadel/internal/repository/features"
|
|
)
|
|
|
|
var (
|
|
FeaturesSetEventType = instanceEventTypePrefix + 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
|
|
}
|