zitadel/internal/repository/instance/features.go
Florian Forster fa9f581d56
chore(v2): move to new org (#3499)
* chore: move to new org

* logging

* fix: org rename caos -> zitadel

Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
2022-04-26 23:01:45 +00:00

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
}