mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +00:00
ebeedd1346
member not working atm
57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
package idp
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/caos/zitadel/internal/errors"
|
|
"github.com/caos/zitadel/internal/eventstore/v2"
|
|
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
|
)
|
|
|
|
type ConfigAddedEvent struct {
|
|
eventstore.BaseEvent `json:"-"`
|
|
|
|
ConfigID string `json:"idpConfigId"`
|
|
Name string `json:"name,omitempty"`
|
|
Typ ConfigType `json:"idpType,omitempty"`
|
|
StylingType StylingType `json:"stylingType,omitempty"`
|
|
}
|
|
|
|
func NewConfigAddedEvent(
|
|
base *eventstore.BaseEvent,
|
|
configID string,
|
|
name string,
|
|
configType ConfigType,
|
|
stylingType StylingType,
|
|
) *ConfigAddedEvent {
|
|
|
|
return &ConfigAddedEvent{
|
|
BaseEvent: *base,
|
|
ConfigID: configID,
|
|
Name: name,
|
|
StylingType: stylingType,
|
|
Typ: configType,
|
|
}
|
|
}
|
|
|
|
func (e *ConfigAddedEvent) CheckPrevious() bool {
|
|
return true
|
|
}
|
|
|
|
func (e *ConfigAddedEvent) Data() interface{} {
|
|
return e
|
|
}
|
|
|
|
func ConfigAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e := &ConfigAddedEvent{
|
|
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
|
}
|
|
|
|
err := json.Unmarshal(event.Data, e)
|
|
if err != nil {
|
|
return nil, errors.ThrowInternal(err, "OIDC-plaBZ", "unable to unmarshal event")
|
|
}
|
|
|
|
return e, nil
|
|
}
|