zitadel/internal/v2/repository/member/event_changed.go

40 lines
640 B
Go
Raw Normal View History

2020-11-06 21:09:19 +00:00
package member
import (
"context"
"github.com/caos/zitadel/internal/eventstore/v2"
)
type MemberChangedEvent struct {
eventstore.BaseEvent `json:"-"`
Roles []string `json:"roles"`
UserID string `json:"userId"`
}
func (e *MemberChangedEvent) CheckPrevious() bool {
return true
}
func (e *MemberChangedEvent) Data() interface{} {
return e
}
func NewMemberChangedEvent(
ctx context.Context,
eventType eventstore.EventType,
userID string,
roles ...string,
) *MemberChangedEvent {
return &MemberChangedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
eventType,
),
Roles: roles,
UserID: userID,
}
}