mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-08 20:17:40 +00:00
ebeedd1346
member not working atm
52 lines
952 B
Go
52 lines
952 B
Go
package provider
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/caos/zitadel/internal/errors"
|
|
"github.com/caos/zitadel/internal/eventstore/v2"
|
|
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
|
)
|
|
|
|
const (
|
|
RemovedEventType = "idpprovider.removed"
|
|
)
|
|
|
|
type RemovedEvent struct {
|
|
eventstore.BaseEvent
|
|
|
|
IDPConfigID string `json:"idpConfigId"`
|
|
}
|
|
|
|
func (e *RemovedEvent) CheckPrevious() bool {
|
|
return true
|
|
}
|
|
|
|
func (e *RemovedEvent) Data() interface{} {
|
|
return e
|
|
}
|
|
|
|
func NewRemovedEvent(
|
|
base *eventstore.BaseEvent,
|
|
idpConfigID string,
|
|
) *RemovedEvent {
|
|
|
|
return &RemovedEvent{
|
|
BaseEvent: *base,
|
|
IDPConfigID: idpConfigID,
|
|
}
|
|
}
|
|
|
|
func RemovedEventEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
|
e := &RemovedEvent{
|
|
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
|
}
|
|
|
|
err := json.Unmarshal(event.Data, e)
|
|
if err != nil {
|
|
return nil, errors.ThrowInternal(err, "PROVI-6H0KQ", "Errors.Internal")
|
|
}
|
|
|
|
return e, nil
|
|
}
|