fix: Previous sequence (#1086)

* feat: remove previous sequence check

* feat: object creation date

* feat: simplify member write model

* feat: simplify write model

* feat: simplify write model
This commit is contained in:
Fabi 2020-12-14 17:24:01 +01:00 committed by GitHub
parent 5b433dcaa3
commit 7f26f1815b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 229 additions and 693 deletions

View File

@ -21,7 +21,7 @@ func (o *ObjectRoot) AppendEvent(event *Event) {
}
o.ChangeDate = event.CreationDate
if event.PreviousSequence == 0 {
if o.CreationDate.IsZero() {
o.CreationDate = o.ChangeDate
}

View File

@ -18,9 +18,6 @@ type EventPusher interface {
// * struct which can be marshalled to json
// * pointer to struct which can be marshalled to json
Data() interface{}
//CheckPrevious ensures the event order if true
// if false the previous sequence is not checked on push
CheckPrevious() bool
}
type EventReader interface {

View File

@ -65,16 +65,15 @@ func (e *BaseEvent) CreationDate() time.Time {
func BaseEventFromRepo(event *repository.Event) *BaseEvent {
return &BaseEvent{
aggregateID: event.AggregateID,
aggregateType: AggregateType(event.AggregateType),
aggregateVersion: Version(event.Version),
EventType: EventType(event.Type),
creationDate: event.CreationDate,
sequence: event.Sequence,
previouseSequence: event.PreviousSequence,
resourceOwner: event.ResourceOwner,
Service: event.EditorService,
User: event.EditorUser,
aggregateID: event.AggregateID,
aggregateType: AggregateType(event.AggregateType),
aggregateVersion: Version(event.Version),
EventType: EventType(event.Type),
creationDate: event.CreationDate,
sequence: event.Sequence,
resourceOwner: event.ResourceOwner,
Service: event.EditorService,
User: event.EditorUser,
}
}

View File

@ -73,17 +73,16 @@ func (es *Eventstore) aggregatesToEvents(aggregates []aggregater) ([]*repository
return nil, err
}
events = append(events, &repository.Event{
AggregateID: aggregate.ID(),
AggregateType: repository.AggregateType(aggregate.Type()),
ResourceOwner: aggregate.ResourceOwner(),
EditorService: event.EditorService(),
EditorUser: event.EditorUser(),
Type: repository.EventType(event.Type()),
Version: repository.Version(aggregate.Version()),
PreviousEvent: previousEvent,
PreviousSequence: aggregate.PreviousSequence(),
Data: data,
CheckPreviousSequence: event.CheckPrevious(),
AggregateID: aggregate.ID(),
AggregateType: repository.AggregateType(aggregate.Type()),
ResourceOwner: aggregate.ResourceOwner(),
EditorService: event.EditorService(),
EditorUser: event.EditorUser(),
Type: repository.EventType(event.Type()),
Version: repository.Version(aggregate.Version()),
PreviousEvent: previousEvent,
PreviousSequence: aggregate.PreviousSequence(),
Data: data,
})
previousEvent = events[len(events)-1]
}

View File

@ -64,10 +64,6 @@ func newTestEvent(description string, data func() interface{}, checkPrevious boo
}
}
func (e *testEvent) CheckPrevious() bool {
return e.shouldCheckPrevious
}
func (e *testEvent) Data() interface{} {
return e.data()
}
@ -392,15 +388,14 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
wantErr: false,
events: []*repository.Event{
{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
},
},
@ -432,26 +427,24 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
wantErr: false,
events: linkEvents(
&repository.Event{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
&repository.Event{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
),
},
@ -516,39 +509,36 @@ func TestEventstore_aggregatesToEvents(t *testing.T) {
events: combineEventLists(
linkEvents(
&repository.Event{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
&repository.Event{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
),
[]*repository.Event{
{
AggregateID: "2",
AggregateType: "test.aggregate",
CheckPreviousSequence: true,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "2",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
},
),
@ -661,15 +651,14 @@ func TestEventstore_Push(t *testing.T) {
t: t,
events: []*repository.Event{
{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
},
},
@ -708,26 +697,24 @@ func TestEventstore_Push(t *testing.T) {
t: t,
events: linkEvents(
&repository.Event{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
&repository.Event{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
),
},
@ -781,39 +768,36 @@ func TestEventstore_Push(t *testing.T) {
events: combineEventLists(
linkEvents(
&repository.Event{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
&repository.Event{
AggregateID: "1",
AggregateType: "test.aggregate",
CheckPreviousSequence: false,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "1",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
),
[]*repository.Event{
{
AggregateID: "2",
AggregateType: "test.aggregate",
CheckPreviousSequence: true,
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
AggregateID: "2",
AggregateType: "test.aggregate",
Data: []byte(nil),
EditorService: "editorService",
EditorUser: "editorUser",
ResourceOwner: "ro",
Type: "test.event",
Version: "v1",
},
},
),
@ -1335,9 +1319,6 @@ func compareEvents(t *testing.T, want, got *repository.Event) {
if want.AggregateType != got.AggregateType {
t.Errorf("wrong aggregateType got %q want %q", want.AggregateType, got.AggregateType)
}
if want.CheckPreviousSequence != got.CheckPreviousSequence {
t.Errorf("wrong check previous got %v want %v", want.CheckPreviousSequence, got.CheckPreviousSequence)
}
if !reflect.DeepEqual(want.Data, got.Data) {
t.Errorf("wrong data got %s want %s", string(want.Data), string(got.Data))
}

View File

@ -80,10 +80,6 @@ func UserAddedEventMapper() (eventstore.EventType, func(*repository.Event) (even
}
}
func (e *UserAddedEvent) CheckPrevious() bool {
return true
}
func (e *UserAddedEvent) Data() interface{} {
return e
}
@ -122,10 +118,6 @@ func UserFirstNameChangedMapper() (eventstore.EventType, func(*repository.Event)
}
}
func (e *UserFirstNameChangedEvent) CheckPrevious() bool {
return true
}
func (e *UserFirstNameChangedEvent) Data() interface{} {
return e
}
@ -156,10 +148,6 @@ func UserPasswordCheckedMapper() (eventstore.EventType, func(*repository.Event)
}
}
func (e *UserPasswordCheckedEvent) CheckPrevious() bool {
return false
}
func (e *UserPasswordCheckedEvent) Data() interface{} {
return nil
}
@ -190,10 +178,6 @@ func UserDeletedMapper() (eventstore.EventType, func(*repository.Event) (eventst
}
}
func (e *UserDeletedEvent) CheckPrevious() bool {
return false
}
func (e *UserDeletedEvent) Data() interface{} {
return nil
}

View File

@ -20,10 +20,6 @@ type Event struct {
// it implements a linked list
PreviousEvent *Event
//CheckPreviousSequence decides if the event can only be written
// if event.PreviousSequence == max(event_sequence) of this aggregate
CheckPreviousSequence bool
//CreationDate is the time the event is created
// it's used for human readability.
// Don't use it for event ordering,

View File

@ -28,7 +28,6 @@ const (
" editor_service, " +
" resource_owner, " +
" previous_sequence, " +
" check_previous, " +
// variables below are calculated
" max_event_seq " +
") AS ( " +
@ -45,7 +44,6 @@ const (
" $8::VARCHAR, " +
" resource_owner, " +
" $10::BIGINT, " +
" $11::BOOLEAN," +
" MAX(event_sequence) AS max_event_seq " +
" FROM eventstore.events " +
" WHERE " +
@ -65,7 +63,6 @@ const (
" $8::VARCHAR, " +
" $9::VARCHAR, " +
" $10::BIGINT, " +
" $11::BOOLEAN, " +
" NULL::BIGINT " +
" ) " +
" ) " +
@ -96,24 +93,8 @@ const (
" editor_user, " +
" editor_service, " +
" resource_owner, " +
" ( " +
" SELECT " +
" CASE " +
" WHEN NOT check_previous " +
" THEN NULL " +
" ELSE previous_sequence " +
" END" +
" ) " +
" previous_sequence " +
" FROM input_event " +
" WHERE 1 = " +
" CASE " +
" WHEN NOT check_previous " +
" THEN 1 " +
" ELSE ( " +
" SELECT 1 FROM input_event " +
" WHERE (max_event_seq IS NULL AND previous_sequence IS NULL) OR (max_event_seq IS NOT NULL AND max_event_seq = previous_sequence) " +
" ) " +
" END " +
" ) " +
"RETURNING id, event_sequence, previous_sequence, creation_date, resource_owner "
)
@ -160,7 +141,6 @@ func (db *CRDB) Push(ctx context.Context, events ...*repository.Event) error {
event.EditorService,
event.ResourceOwner,
previousSequence,
event.CheckPreviousSequence,
).Scan(&event.ID, &event.Sequence, &previousSequence, &event.CreationDate, &event.ResourceOwner)
event.PreviousSequence = uint64(previousSequence)

View File

@ -143,7 +143,7 @@ func writeModelToMember(writeModel *iam.MemberWriteModel) *model.IAMMember {
func writeModelToLoginPolicy(wm *login.WriteModel) *model.LoginPolicy {
return &model.LoginPolicy{
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
ObjectRoot: writeModelToObjectRoot(wm.Policy.WriteModel),
AllowUsernamePassword: wm.Policy.AllowUserNamePassword,
AllowRegister: wm.Policy.AllowRegister,
AllowExternalIdp: wm.Policy.AllowExternalIDP,
@ -154,7 +154,7 @@ func writeModelToLoginPolicy(wm *login.WriteModel) *model.LoginPolicy {
func writeModelToLabelPolicy(wm *label.WriteModel) *model.LabelPolicy {
return &model.LabelPolicy{
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
ObjectRoot: writeModelToObjectRoot(wm.Policy.WriteModel),
PrimaryColor: wm.Policy.PrimaryColor,
SecondaryColor: wm.Policy.SecondaryColor,
}
@ -162,14 +162,14 @@ func writeModelToLabelPolicy(wm *label.WriteModel) *model.LabelPolicy {
func writeModelToOrgIAMPolicy(wm *org_iam.WriteModel) *model.OrgIAMPolicy {
return &model.OrgIAMPolicy{
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
ObjectRoot: writeModelToObjectRoot(wm.Policy.WriteModel),
UserLoginMustBeDomain: wm.Policy.UserLoginMustBeDomain,
}
}
func writeModelToPasswordAgePolicy(wm *password_age.WriteModel) *model.PasswordAgePolicy {
return &model.PasswordAgePolicy{
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
ObjectRoot: writeModelToObjectRoot(wm.Policy.WriteModel),
MaxAgeDays: wm.Policy.MaxAgeDays,
ExpireWarnDays: wm.Policy.ExpireWarnDays,
}
@ -177,7 +177,7 @@ func writeModelToPasswordAgePolicy(wm *password_age.WriteModel) *model.PasswordA
func writeModelToPasswordComplexityPolicy(wm *password_complexity.WriteModel) *model.PasswordComplexityPolicy {
return &model.PasswordComplexityPolicy{
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
ObjectRoot: writeModelToObjectRoot(wm.Policy.WriteModel),
MinLength: wm.Policy.MinLength,
HasLowercase: wm.Policy.HasLowercase,
HasUppercase: wm.Policy.HasUpperCase,
@ -188,7 +188,7 @@ func writeModelToPasswordComplexityPolicy(wm *password_complexity.WriteModel) *m
func writeModelToPasswordLockoutPolicy(wm *password_lockout.WriteModel) *model.PasswordLockoutPolicy {
return &model.PasswordLockoutPolicy{
ObjectRoot: writeModelToObjectRoot(wm.WriteModel),
ObjectRoot: writeModelToObjectRoot(wm.Policy.WriteModel),
MaxAttempts: wm.Policy.MaxAttempts,
ShowLockOutFailures: wm.Policy.ShowLockOutFailures,
}

View File

@ -26,7 +26,7 @@ func (r *Repository) AddMember(ctx context.Context, member *iam_model.IAMMember)
return nil, errors.ThrowAlreadyExists(nil, "IAM-PtXi1", "Errors.IAM.Member.AlreadyExists")
}
iamAgg := iam_repo.AggregateFromWriteModel(&addedMember.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&addedMember.Member.WriteModel).
PushMemberAdded(ctx, member.UserID, member.Roles...)
err = r.eventstore.PushAggregate(ctx, addedMember, iamAgg)
@ -50,7 +50,7 @@ func (r *Repository) ChangeMember(ctx context.Context, member *iam_model.IAMMemb
return nil, err
}
iam := iam_repo.AggregateFromWriteModel(&existingMember.WriteModel).
iam := iam_repo.AggregateFromWriteModel(&existingMember.Member.WriteModel).
PushMemberChangedFromExisting(ctx, existingMember, member.Roles...)
events, err := r.eventstore.PushAggregates(ctx, iam)
@ -75,7 +75,7 @@ func (r *Repository) RemoveMember(ctx context.Context, member *iam_model.IAMMemb
return nil
}
iamAgg := iam_repo.AggregateFromWriteModel(&m.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&m.Member.WriteModel).
PushEvents(iam_repo.NewMemberRemovedEvent(ctx, member.UserID))
return r.eventstore.PushAggregate(ctx, m, iamAgg)

View File

@ -19,7 +19,7 @@ func (r *Repository) AddOrgIAMPolicy(ctx context.Context, policy *iam_model.OrgI
return nil, caos_errs.ThrowAlreadyExists(nil, "IAM-Lk0dS", "Errors.IAM.OrgIAMPolicy.AlreadyExists")
}
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.Policy.WriteModel).
PushOrgIAMPolicyAddedEvent(ctx, policy.UserLoginMustBeDomain)
err = r.eventstore.PushAggregate(ctx, addedPolicy, iamAgg)
@ -36,7 +36,7 @@ func (r *Repository) ChangeOrgIAMPolicy(ctx context.Context, policy *iam_model.O
return nil, err
}
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.Policy.WriteModel).
PushOrgIAMPolicyChangedFromExisting(ctx, existingPolicy, policy.UserLoginMustBeDomain)
err = r.eventstore.PushAggregate(ctx, existingPolicy, iamAgg)

View File

@ -24,7 +24,7 @@ func (r *Repository) AddLabelPolicy(ctx context.Context, policy *iam_model.Label
return nil, caos_errs.ThrowAlreadyExists(nil, "IAM-2B0ps", "Errors.IAM.LabelPolicy.AlreadyExists")
}
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.Policy.WriteModel).
PushLabelPolicyAddedEvent(ctx, policy.PrimaryColor, policy.SecondaryColor)
err = r.eventstore.PushAggregate(ctx, addedPolicy, iamAgg)
@ -45,7 +45,7 @@ func (r *Repository) ChangeLabelPolicy(ctx context.Context, policy *iam_model.La
return nil, err
}
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.Policy.WriteModel).
PushLabelPolicyChangedFromExisting(ctx, existingPolicy, policy.PrimaryColor, policy.SecondaryColor)
err = r.eventstore.PushAggregate(ctx, existingPolicy, iamAgg)

View File

@ -28,7 +28,7 @@ func (r *Repository) AddLoginPolicy(ctx context.Context, policy *iam_model.Login
return nil, caos_errs.ThrowAlreadyExists(nil, "IAM-2B0ps", "Errors.IAM.LoginPolicy.AlreadyExists")
}
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.Policy.WriteModel).
PushLoginPolicyAddedEvent(ctx, policy.AllowUsernamePassword, policy.AllowRegister, policy.AllowExternalIdp, policy.ForceMFA, login.PasswordlessType(policy.PasswordlessType))
err = r.eventstore.PushAggregate(ctx, addedPolicy, iamAgg)
@ -49,7 +49,7 @@ func (r *Repository) ChangeLoginPolicy(ctx context.Context, policy *iam_model.Lo
return nil, err
}
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.Policy.WriteModel).
PushLoginPolicyChangedFromExisting(ctx, existingPolicy, policy.AllowUsernamePassword, policy.AllowRegister, policy.AllowExternalIdp, policy.ForceMFA, login.PasswordlessType(policy.PasswordlessType))
err = r.eventstore.PushAggregate(ctx, existingPolicy, iamAgg)
@ -96,7 +96,7 @@ func (r *Repository) AddSecondFactorToLoginPolicy(ctx context.Context, iamID str
return iam_model.SecondFactorTypeUnspecified, err
}
aggregate := iam_repo.AggregateFromWriteModel(&writeModel.WriteModel).
aggregate := iam_repo.AggregateFromWriteModel(&writeModel.SecondFactor.WriteModel).
PushLoginPolicySecondFactorAdded(ctx, factors.SecondFactorType(secondFactor))
if err = r.eventstore.PushAggregate(ctx, writeModel, aggregate); err != nil {
@ -112,7 +112,7 @@ func (r *Repository) RemoveSecondFactorFromLoginPolicy(ctx context.Context, iamI
if err != nil {
return err
}
aggregate := iam_repo.AggregateFromWriteModel(&writeModel.WriteModel).
aggregate := iam_repo.AggregateFromWriteModel(&writeModel.SecondFactor.WriteModel).
PushLoginPolicySecondFactorRemoved(ctx, factors.SecondFactorType(secondFactor))
return r.eventstore.PushAggregate(ctx, writeModel, aggregate)
@ -125,7 +125,7 @@ func (r *Repository) AddMultiFactorToLoginPolicy(ctx context.Context, iamID stri
return iam_model.MultiFactorTypeUnspecified, err
}
aggregate := iam_repo.AggregateFromWriteModel(&writeModel.WriteModel).
aggregate := iam_repo.AggregateFromWriteModel(&writeModel.MultiFactor.WriteModel).
PushLoginPolicyMultiFactorAdded(ctx, factors.MultiFactorType(secondFactor))
if err = r.eventstore.PushAggregate(ctx, writeModel, aggregate); err != nil {
@ -141,7 +141,7 @@ func (r *Repository) RemoveMultiFactorFromLoginPolicy(ctx context.Context, iamID
if err != nil {
return err
}
aggregate := iam_repo.AggregateFromWriteModel(&writeModel.WriteModel).
aggregate := iam_repo.AggregateFromWriteModel(&writeModel.MultiFactor.WriteModel).
PushLoginPolicyMultiFactorRemoved(ctx, factors.MultiFactorType(secondFactor))
return r.eventstore.PushAggregate(ctx, writeModel, aggregate)

View File

@ -19,7 +19,7 @@ func (r *Repository) AddPasswordAgePolicy(ctx context.Context, policy *iam_model
return nil, caos_errs.ThrowAlreadyExists(nil, "IAM-6L0pd", "Errors.IAM.PasswordAgePolicy.AlreadyExists")
}
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.Policy.WriteModel).
PushPasswordAgePolicyAddedEvent(ctx, policy.ExpireWarnDays, policy.MaxAgeDays)
err = r.eventstore.PushAggregate(ctx, addedPolicy, iamAgg)
@ -36,7 +36,7 @@ func (r *Repository) ChangePasswordAgePolicy(ctx context.Context, policy *iam_mo
return nil, err
}
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.Policy.WriteModel).
PushPasswordAgePolicyChangedFromExisting(ctx, existingPolicy, policy.ExpireWarnDays, policy.MaxAgeDays)
err = r.eventstore.PushAggregate(ctx, existingPolicy, iamAgg)

View File

@ -23,7 +23,7 @@ func (r *Repository) AddPasswordComplexityPolicy(ctx context.Context, policy *ia
return nil, caos_errs.ThrowAlreadyExists(nil, "IAM-Lk0dS", "Errors.IAM.PasswordComplexityPolicy.AlreadyExists")
}
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.Policy.WriteModel).
PushPasswordComplexityPolicyAddedEvent(ctx, policy.MinLength, policy.HasLowercase, policy.HasUppercase, policy.HasNumber, policy.HasSymbol)
err = r.eventstore.PushAggregate(ctx, addedPolicy, iamAgg)
@ -44,7 +44,7 @@ func (r *Repository) ChangePasswordComplexityPolicy(ctx context.Context, policy
return nil, err
}
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.Policy.WriteModel).
PushPasswordComplexityPolicyChangedFromExisting(ctx, existingPolicy, policy.MinLength, policy.HasLowercase, policy.HasUppercase, policy.HasNumber, policy.HasSymbol)
err = r.eventstore.PushAggregate(ctx, existingPolicy, iamAgg)

View File

@ -19,7 +19,7 @@ func (r *Repository) AddPasswordLockoutPolicy(ctx context.Context, policy *iam_m
return nil, caos_errs.ThrowAlreadyExists(nil, "IAM-0olDf", "Errors.IAM.PasswordLockoutPolicy.AlreadyExists")
}
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&addedPolicy.Policy.WriteModel).
PushPasswordLockoutPolicyAddedEvent(ctx, policy.MaxAttempts, policy.ShowLockOutFailures)
err = r.eventstore.PushAggregate(ctx, addedPolicy, iamAgg)
@ -36,7 +36,7 @@ func (r *Repository) ChangePasswordLockoutPolicy(ctx context.Context, policy *ia
return nil, err
}
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.WriteModel).
iamAgg := iam_repo.AggregateFromWriteModel(&existingPolicy.Policy.WriteModel).
PushPasswordLockoutPolicyChangedFromExisting(ctx, existingPolicy, policy.MaxAttempts, policy.ShowLockOutFailures)
err = r.eventstore.PushAggregate(ctx, existingPolicy, iamAgg)

View File

@ -19,10 +19,6 @@ type ProjectSetEvent struct {
ProjectID string `json:"iamProjectId"`
}
func (e *ProjectSetEvent) CheckPrevious() bool {
return e.Type() == SetupStartedEventType
}
func (e *ProjectSetEvent) Data() interface{} {
return e
}

View File

@ -19,10 +19,6 @@ type GlobalOrgSetEvent struct {
OrgID string `json:"globalOrgId"`
}
func (e *GlobalOrgSetEvent) CheckPrevious() bool {
return true
}
func (e *GlobalOrgSetEvent) Data() interface{} {
return e
}

View File

@ -23,10 +23,6 @@ type SetupStepEvent struct {
Done bool `json:"-"`
}
func (e *SetupStepEvent) CheckPrevious() bool {
return e.Type() == SetupStartedEventType
}
func (e *SetupStepEvent) Data() interface{} {
return e
}

View File

@ -50,53 +50,49 @@ func (rm *MemberReadModel) Query() *eventstore.SearchQueryBuilder {
}
type MemberWriteModel struct {
eventstore.WriteModel
Member member.WriteModel
userID string
iamID string
member.WriteModel
}
func NewMemberWriteModel(iamID, userID string) *MemberWriteModel {
return &MemberWriteModel{
userID: userID,
iamID: iamID,
member.WriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
UserID: userID,
},
}
}
func (wm *MemberWriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *MemberAddedEvent:
if e.UserID != wm.userID {
if e.UserID != wm.WriteModel.UserID {
continue
}
wm.Member.AppendEvents(&e.AddedEvent)
wm.WriteModel.AppendEvents(&e.AddedEvent)
case *MemberChangedEvent:
if e.UserID != wm.userID {
if e.UserID != wm.WriteModel.UserID {
continue
}
wm.Member.AppendEvents(&e.ChangedEvent)
wm.WriteModel.AppendEvents(&e.ChangedEvent)
case *MemberRemovedEvent:
if e.UserID != wm.userID {
if e.UserID != wm.WriteModel.UserID {
continue
}
wm.Member.AppendEvents(&e.RemovedEvent)
wm.WriteModel.AppendEvents(&e.RemovedEvent)
}
}
}
func (wm *MemberWriteModel) Reduce() error {
if err := wm.Member.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *MemberWriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}
type MemberAddedEvent struct {
@ -145,7 +141,7 @@ func MemberChangedEventFromExisting(
ctx,
MemberChangedEventType,
),
&current.Member,
&current.WriteModel,
roles...,
)
if err != nil {

View File

@ -10,38 +10,35 @@ const (
)
type WriteModel struct {
eventstore.WriteModel
Policy label.WriteModel
iamID string
label.WriteModel
}
func NewWriteModel(iamID string) *WriteModel {
return &WriteModel{
iamID: iamID,
label.WriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
},
}
}
func (wm *WriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *AddedEvent:
wm.Policy.AppendEvents(&e.AddedEvent)
wm.WriteModel.AppendEvents(&e.AddedEvent)
case *ChangedEvent:
wm.Policy.AppendEvents(&e.ChangedEvent)
wm.WriteModel.AppendEvents(&e.ChangedEvent)
}
}
}
func (wm *WriteModel) Reduce() error {
if err := wm.Policy.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *WriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}

View File

@ -10,71 +10,65 @@ const (
)
type SecondFactorWriteModel struct {
eventstore.WriteModel
SecondFactor factors.SecondFactoryWriteModel
iamID string
factors.SecondFactorWriteModel
}
func NewSecondFactorWriteModel(iamID string) *SecondFactorWriteModel {
return &SecondFactorWriteModel{
iamID: iamID,
factors.SecondFactorWriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
},
}
}
func (wm *SecondFactorWriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *LoginPolicySecondFactorAddedEvent:
wm.SecondFactor.AppendEvents(&e.SecondFactorAddedEvent)
wm.WriteModel.AppendEvents(&e.SecondFactorAddedEvent)
}
}
}
func (wm *SecondFactorWriteModel) Reduce() error {
if err := wm.SecondFactor.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *SecondFactorWriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}
type MultiFactorWriteModel struct {
eventstore.WriteModel
MultiFactor factors.MultiFactoryWriteModel
iamID string
factors.MultiFactoryWriteModel
}
func NewMultiFactorWriteModel(iamID string) *MultiFactorWriteModel {
return &MultiFactorWriteModel{
iamID: iamID,
factors.MultiFactoryWriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
},
}
}
func (wm *MultiFactorWriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *LoginPolicyMultiFactorAddedEvent:
wm.MultiFactor.AppendEvents(&e.MultiFactorAddedEvent)
wm.WriteModel.AppendEvents(&e.MultiFactorAddedEvent)
}
}
}
func (wm *MultiFactorWriteModel) Reduce() error {
if err := wm.MultiFactor.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *MultiFactorWriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}

View File

@ -10,38 +10,35 @@ const (
)
type WriteModel struct {
eventstore.WriteModel
Policy login.WriteModel
iamID string
login.WriteModel
}
func NewWriteModel(iamID string) *WriteModel {
return &WriteModel{
iamID: iamID,
login.WriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
},
}
}
func (wm *WriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *AddedEvent:
wm.Policy.AppendEvents(&e.AddedEvent)
wm.WriteModel.AppendEvents(&e.AddedEvent)
case *ChangedEvent:
wm.Policy.AppendEvents(&e.ChangedEvent)
wm.WriteModel.AppendEvents(&e.ChangedEvent)
}
}
}
func (wm *WriteModel) Reduce() error {
if err := wm.Policy.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *WriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}

View File

@ -10,38 +10,35 @@ const (
)
type WriteModel struct {
eventstore.WriteModel
Policy org_iam.WriteModel
iamID string
org_iam.WriteModel
}
func NewWriteModel(iamID string) *WriteModel {
return &WriteModel{
iamID: iamID,
org_iam.WriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
},
}
}
func (wm *WriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *AddedEvent:
wm.Policy.AppendEvents(&e.AddedEvent)
wm.WriteModel.AppendEvents(&e.AddedEvent)
case *ChangedEvent:
wm.Policy.AppendEvents(&e.ChangedEvent)
wm.WriteModel.AppendEvents(&e.ChangedEvent)
}
}
}
func (wm *WriteModel) Reduce() error {
if err := wm.Policy.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *WriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}

View File

@ -10,38 +10,35 @@ const (
)
type WriteModel struct {
eventstore.WriteModel
Policy password_age.WriteModel
iamID string
password_age.WriteModel
}
func NewWriteModel(iamID string) *WriteModel {
return &WriteModel{
iamID: iamID,
password_age.WriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
},
}
}
func (wm *WriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *AddedEvent:
wm.Policy.AppendEvents(&e.AddedEvent)
wm.WriteModel.AppendEvents(&e.AddedEvent)
case *ChangedEvent:
wm.Policy.AppendEvents(&e.ChangedEvent)
wm.WriteModel.AppendEvents(&e.ChangedEvent)
}
}
}
func (wm *WriteModel) Reduce() error {
if err := wm.Policy.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *WriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}

View File

@ -10,38 +10,35 @@ const (
)
type WriteModel struct {
eventstore.WriteModel
Policy password_complexity.WriteModel
iamID string
password_complexity.WriteModel
}
func NewWriteModel(iamID string) *WriteModel {
return &WriteModel{
iamID: iamID,
password_complexity.WriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
},
}
}
func (wm *WriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *AddedEvent:
wm.Policy.AppendEvents(&e.AddedEvent)
wm.WriteModel.AppendEvents(&e.AddedEvent)
case *ChangedEvent:
wm.Policy.AppendEvents(&e.ChangedEvent)
wm.WriteModel.AppendEvents(&e.ChangedEvent)
}
}
}
func (wm *WriteModel) Reduce() error {
if err := wm.Policy.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *WriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}

View File

@ -10,38 +10,35 @@ const (
)
type WriteModel struct {
eventstore.WriteModel
Policy password_lockout.WriteModel
iamID string
password_lockout.WriteModel
}
func NewWriteModel(iamID string) *WriteModel {
return &WriteModel{
iamID: iamID,
password_lockout.WriteModel{
WriteModel: eventstore.WriteModel{
AggregateID: iamID,
},
},
}
}
func (wm *WriteModel) AppendEvents(events ...eventstore.EventReader) {
wm.WriteModel.AppendEvents(events...)
for _, event := range events {
switch e := event.(type) {
case *AddedEvent:
wm.Policy.AppendEvents(&e.AddedEvent)
wm.WriteModel.AppendEvents(&e.AddedEvent)
case *ChangedEvent:
wm.Policy.AppendEvents(&e.ChangedEvent)
wm.WriteModel.AppendEvents(&e.ChangedEvent)
}
}
}
func (wm *WriteModel) Reduce() error {
if err := wm.Policy.Reduce(); err != nil {
return err
}
return wm.WriteModel.Reduce()
}
func (wm *WriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).
AggregateIDs(wm.iamID)
AggregateIDs(wm.WriteModel.AggregateID)
}

View File

@ -34,10 +34,6 @@ func NewConfigAddedEvent(
}
}
func (e *ConfigAddedEvent) CheckPrevious() bool {
return true
}
func (e *ConfigAddedEvent) Data() interface{} {
return e
}

View File

@ -45,10 +45,6 @@ func NewConfigChangedEvent(
return change, nil
}
func (e *ConfigChangedEvent) CheckPrevious() bool {
return true
}
func (e *ConfigChangedEvent) Data() interface{} {
return e
}

View File

@ -25,10 +25,6 @@ func NewConfigDeactivatedEvent(
}
}
func (e *ConfigDeactivatedEvent) CheckPrevious() bool {
return true
}
func (e *ConfigDeactivatedEvent) Data() interface{} {
return e
}

View File

@ -25,10 +25,6 @@ func NewConfigReactivatedEvent(
}
}
func (e *ConfigReactivatedEvent) CheckPrevious() bool {
return true
}
func (e *ConfigReactivatedEvent) Data() interface{} {
return e
}

View File

@ -25,10 +25,6 @@ func NewConfigRemovedEvent(
}
}
func (e *ConfigRemovedEvent) CheckPrevious() bool {
return true
}
func (e *ConfigRemovedEvent) Data() interface{} {
return e
}

View File

@ -26,10 +26,6 @@ type ConfigAddedEvent struct {
UserNameMapping MappingField `json:"usernameMapping,omitempty"`
}
func (e *ConfigAddedEvent) CheckPrevious() bool {
return true
}
func (e *ConfigAddedEvent) Data() interface{} {
return e
}

View File

@ -29,10 +29,6 @@ type ConfigChangedEvent struct {
UserNameMapping MappingField `json:"usernameMapping,omitempty"`
}
func (e *ConfigChangedEvent) CheckPrevious() bool {
return true
}
func (e *ConfigChangedEvent) Data() interface{} {
return e
}

View File

@ -19,10 +19,6 @@ type AddedEvent struct {
IDPProviderType Type `json:"idpProviderType"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}

View File

@ -18,10 +18,6 @@ type RemovedEvent struct {
IDPConfigID string `json:"idpConfigId"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return e
}

View File

@ -19,10 +19,6 @@ type AddedEvent struct {
UserID string `json:"userId"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}

View File

@ -21,10 +21,6 @@ type ChangedEvent struct {
UserID string `json:"userId,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}

View File

@ -18,10 +18,6 @@ type RemovedEvent struct {
UserID string `json:"userId"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return e
}

View File

@ -20,10 +20,6 @@ type AddedEvent struct {
SecondaryColor string `json:"secondaryColor,omitempty"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -61,10 +57,6 @@ type ChangedEvent struct {
SecondaryColor string `json:"secondaryColor,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}
@ -106,10 +98,6 @@ type RemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return nil
}

View File

@ -27,10 +27,6 @@ type AddedEvent struct {
PasswordlessType PasswordlessType `json:"passwordlessType"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -76,10 +72,6 @@ type ChangedEvent struct {
PasswordlessType PasswordlessType `json:"passwordlessType"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}
@ -134,10 +126,6 @@ type RemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return nil
}

View File

@ -46,10 +46,6 @@ func SecondFactorAddedEventMapper(event *repository.Event) (eventstore.EventRead
return e, nil
}
func (e *SecondFactorAddedEvent) CheckPrevious() bool {
return true
}
func (e *SecondFactorAddedEvent) Data() interface{} {
return e
}
@ -82,10 +78,6 @@ func SecondFactorRemovedEventMapper(event *repository.Event) (eventstore.EventRe
return e, nil
}
func (e *SecondFactorRemovedEvent) CheckPrevious() bool {
return true
}
func (e *SecondFactorRemovedEvent) Data() interface{} {
return e
}
@ -119,10 +111,6 @@ func MultiFactorAddedEventMapper(event *repository.Event) (eventstore.EventReade
return e, nil
}
func (e *MultiFactorAddedEvent) CheckPrevious() bool {
return true
}
func (e *MultiFactorAddedEvent) Data() interface{} {
return e
}
@ -155,10 +143,6 @@ func MultiFactorRemovedEventMapper(event *repository.Event) (eventstore.EventRea
return e, nil
}
func (e *MultiFactorRemovedEvent) CheckPrevious() bool {
return true
}
func (e *MultiFactorRemovedEvent) Data() interface{} {
return e
}

View File

@ -2,12 +2,12 @@ package factors
import "github.com/caos/zitadel/internal/eventstore/v2"
type SecondFactoryWriteModel struct {
type SecondFactorWriteModel struct {
eventstore.WriteModel
MFAType SecondFactorType
}
func (wm *SecondFactoryWriteModel) Reduce() error {
func (wm *SecondFactorWriteModel) Reduce() error {
for _, event := range wm.Events {
switch e := event.(type) {
case *SecondFactorAddedEvent:

View File

@ -18,10 +18,6 @@ type AddedEvent struct {
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -56,10 +52,6 @@ type ChangedEvent struct {
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}

View File

@ -20,10 +20,6 @@ type AddedEvent struct {
MaxAgeDays uint64 `json:"maxAgeDays"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -61,10 +57,6 @@ type ChangedEvent struct {
MaxAgeDays uint64 `json:"maxAgeDays,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}
@ -107,10 +99,6 @@ type RemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return nil
}

View File

@ -23,10 +23,6 @@ type AddedEvent struct {
HasSymbol bool `json:"hasSymbol"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -72,10 +68,6 @@ type ChangedEvent struct {
HasSymbol bool `json:"hasSymbol"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}
@ -130,10 +122,6 @@ type RemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return nil
}

View File

@ -20,10 +20,6 @@ type AddedEvent struct {
ShowLockOutFailures bool `json:"showLockOutFailures"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -61,10 +57,6 @@ type ChangedEvent struct {
ShowLockOutFailures bool `json:"showLockOutFailures,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}
@ -107,10 +99,6 @@ type RemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return nil
}

View File

@ -26,10 +26,6 @@ type LockedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *LockedEvent) CheckPrevious() bool {
return true
}
func (e *LockedEvent) Data() interface{} {
return nil
}
@ -53,10 +49,6 @@ type UnlockedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *UnlockedEvent) CheckPrevious() bool {
return true
}
func (e *UnlockedEvent) Data() interface{} {
return nil
}
@ -80,10 +72,6 @@ type DeactivatedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *DeactivatedEvent) CheckPrevious() bool {
return true
}
func (e *DeactivatedEvent) Data() interface{} {
return nil
}
@ -107,10 +95,6 @@ type ReactivatedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *ReactivatedEvent) CheckPrevious() bool {
return true
}
func (e *ReactivatedEvent) Data() interface{} {
return nil
}
@ -134,10 +118,6 @@ type RemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return nil
}
@ -169,10 +149,6 @@ type TokenAddedEvent struct {
PreferredLanguage string `json:"preferredLanguage"`
}
func (e *TokenAddedEvent) CheckPrevious() bool {
return false
}
func (e *TokenAddedEvent) Data() interface{} {
return e
}
@ -219,10 +195,6 @@ type DomainClaimedEvent struct {
UserName string `json:"userName"`
}
func (e *DomainClaimedEvent) CheckPrevious() bool {
return false
}
func (e *DomainClaimedEvent) Data() interface{} {
return e
}
@ -256,10 +228,6 @@ type DomainClaimedSentEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *DomainClaimedSentEvent) CheckPrevious() bool {
return false
}
func (e *DomainClaimedSentEvent) Data() interface{} {
return nil
}
@ -287,10 +255,6 @@ type UsernameChangedEvent struct {
UserName string `json:"userName"`
}
func (e *UsernameChangedEvent) CheckPrevious() bool {
return false
}
func (e *UsernameChangedEvent) Data() interface{} {
return e
}

View File

@ -23,10 +23,6 @@ type ChangedEvent struct {
StreetAddress string `json:"streetAddress,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}

View File

@ -25,10 +25,6 @@ type ChangedEvent struct {
EmailAddress string `json:"email,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}
@ -68,10 +64,6 @@ type VerifiedEvent struct {
IsEmailVerified bool `json:"-"`
}
func (e *VerifiedEvent) CheckPrevious() bool {
return true
}
func (e *VerifiedEvent) Data() interface{} {
return nil
}
@ -97,10 +89,6 @@ type VerificationFailedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *VerificationFailedEvent) CheckPrevious() bool {
return false
}
func (e *VerificationFailedEvent) Data() interface{} {
return nil
}
@ -127,10 +115,6 @@ type CodeAddedEvent struct {
Expiry time.Duration `json:"expiry,omitempty"`
}
func (e *CodeAddedEvent) CheckPrevious() bool {
return true
}
func (e *CodeAddedEvent) Data() interface{} {
return e
}
@ -165,10 +149,6 @@ type CodeSentEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *CodeSentEvent) CheckPrevious() bool {
return true
}
func (e *CodeSentEvent) Data() interface{} {
return nil
}

View File

@ -45,10 +45,6 @@ type AddedEvent struct {
StreetAddress string `json:"streetAddress,omitempty"`
}
func (e *AddedEvent) CheckPrevious() bool {
return false
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -127,10 +123,6 @@ type RegisteredEvent struct {
StreetAddress string `json:"streetAddress,omitempty"`
}
func (e *RegisteredEvent) CheckPrevious() bool {
return false
}
func (e *RegisteredEvent) Data() interface{} {
return e
}
@ -192,10 +184,6 @@ type InitialCodeAddedEvent struct {
Expiry time.Duration `json:"expiry,omitempty"`
}
func (e *InitialCodeAddedEvent) CheckPrevious() bool {
return true
}
func (e *InitialCodeAddedEvent) Data() interface{} {
return e
}
@ -231,10 +219,6 @@ type InitialCodeSentEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *InitialCodeSentEvent) CheckPrevious() bool {
return false
}
func (e *InitialCodeSentEvent) Data() interface{} {
return nil
}
@ -258,10 +242,6 @@ type InitializedCheckSucceededEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *InitializedCheckSucceededEvent) CheckPrevious() bool {
return false
}
func (e *InitializedCheckSucceededEvent) Data() interface{} {
return nil
}
@ -285,10 +265,6 @@ type InitializedCheckFailedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *InitializedCheckFailedEvent) CheckPrevious() bool {
return false
}
func (e *InitializedCheckFailedEvent) Data() interface{} {
return nil
}
@ -312,10 +288,6 @@ type SignedOutEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *SignedOutEvent) CheckPrevious() bool {
return false
}
func (e *SignedOutEvent) Data() interface{} {
return nil
}

View File

@ -27,10 +27,6 @@ type ReservedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *ReservedEvent) CheckPrevious() bool {
return true
}
func (e *ReservedEvent) Data() interface{} {
return nil
}
@ -48,10 +44,6 @@ type ReleasedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *ReleasedEvent) CheckPrevious() bool {
return true
}
func (e *ReleasedEvent) Data() interface{} {
return nil
}
@ -72,10 +64,6 @@ type AddedEvent struct {
DisplayName string `json:"displayName,omitempty"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -110,10 +98,6 @@ type RemovedEvent struct {
IDPConfigID string `json:"idpConfigId"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return e
}
@ -147,10 +131,6 @@ type CascadeRemovedEvent struct {
IDPConfigID string `json:"idpConfigId"`
}
func (e *CascadeRemovedEvent) CheckPrevious() bool {
return false
}
func (e *CascadeRemovedEvent) Data() interface{} {
return e
}
@ -182,10 +162,6 @@ type CheckSucceededEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *CheckSucceededEvent) CheckPrevious() bool {
return false
}
func (e *CheckSucceededEvent) Data() interface{} {
return nil
}

View File

@ -15,10 +15,6 @@ type InitSkippedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *InitSkippedEvent) CheckPrevious() bool {
return true
}
func (e *InitSkippedEvent) Data() interface{} {
return e
}

View File

@ -26,10 +26,6 @@ type AddedEvent struct {
State mfa.State `json:"-"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -62,10 +58,6 @@ type VerifiedEvent struct {
State mfa.State `json:"-"`
}
func (e *VerifiedEvent) CheckPrevious() bool {
return true
}
func (e *VerifiedEvent) Data() interface{} {
return nil
}
@ -90,10 +82,6 @@ type RemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return nil
}
@ -117,10 +105,6 @@ type CheckSucceededEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *CheckSucceededEvent) CheckPrevious() bool {
return false
}
func (e *CheckSucceededEvent) Data() interface{} {
return nil
}
@ -144,10 +128,6 @@ type CheckFailedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *CheckFailedEvent) CheckPrevious() bool {
return false
}
func (e *CheckFailedEvent) Data() interface{} {
return nil
}

View File

@ -37,10 +37,6 @@ type AddedEvent struct {
State mfa.State `json:"-"`
}
func (e *AddedEvent) CheckPrevious() bool {
return true
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -100,10 +96,6 @@ type VerifiedEvent struct {
State mfa.State `json:"-"`
}
func (e *VerifiedEvent) CheckPrevious() bool {
return true
}
func (e *VerifiedEvent) Data() interface{} {
return e
}
@ -178,10 +170,6 @@ type SignCountChangedEvent struct {
State mfa.State `json:"-"`
}
func (e *SignCountChangedEvent) CheckPrevious() bool {
return true
}
func (e *SignCountChangedEvent) Data() interface{} {
return e
}
@ -234,10 +222,6 @@ type RemovedEvent struct {
State mfa.State `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return e
}
@ -288,10 +272,6 @@ type BeginLoginEvent struct {
//*AuthRequest
}
func (e *BeginLoginEvent) CheckPrevious() bool {
return true
}
func (e *BeginLoginEvent) Data() interface{} {
return e
}
@ -344,10 +324,6 @@ type CheckSucceededEvent struct {
//*AuthRequest
}
func (e *CheckSucceededEvent) CheckPrevious() bool {
return true
}
func (e *CheckSucceededEvent) Data() interface{} {
return e
}
@ -388,10 +364,6 @@ type CheckFailedEvent struct {
//*AuthRequest
}
func (e *CheckFailedEvent) CheckPrevious() bool {
return true
}
func (e *CheckFailedEvent) Data() interface{} {
return e
}

View File

@ -27,10 +27,6 @@ type ChangedEvent struct {
ChangeRequired bool `json:"changeRequired,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return false
}
func (e *ChangedEvent) Data() interface{} {
return e
}
@ -70,10 +66,6 @@ type CodeAddedEvent struct {
NotificationType human.NotificationType `json:"notificationType,omitempty"`
}
func (e *CodeAddedEvent) CheckPrevious() bool {
return false
}
func (e *CodeAddedEvent) Data() interface{} {
return e
}
@ -111,10 +103,6 @@ type CodeSentEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *CodeSentEvent) CheckPrevious() bool {
return false
}
func (e *CodeSentEvent) Data() interface{} {
return nil
}
@ -138,10 +126,6 @@ type CheckSucceededEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *CheckSucceededEvent) CheckPrevious() bool {
return false
}
func (e *CheckSucceededEvent) Data() interface{} {
return nil
}
@ -165,10 +149,6 @@ type CheckFailedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *CheckFailedEvent) CheckPrevious() bool {
return false
}
func (e *CheckFailedEvent) Data() interface{} {
return nil
}

View File

@ -26,10 +26,6 @@ type ChangedEvent struct {
PhoneNumber string `json:"phone,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}
@ -60,10 +56,6 @@ type RemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return nil
}
@ -89,10 +81,6 @@ type VerifiedEvent struct {
IsPhoneVerified bool `json:"-"`
}
func (e *VerifiedEvent) CheckPrevious() bool {
return true
}
func (e *VerifiedEvent) Data() interface{} {
return nil
}
@ -117,10 +105,6 @@ type VerificationFailedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *VerificationFailedEvent) CheckPrevious() bool {
return true
}
func (e *VerificationFailedEvent) Data() interface{} {
return nil
}
@ -147,10 +131,6 @@ type CodeAddedEvent struct {
Expiry time.Duration `json:"expiry,omitempty"`
}
func (e *CodeAddedEvent) CheckPrevious() bool {
return true
}
func (e *CodeAddedEvent) Data() interface{} {
return e
}
@ -186,10 +166,6 @@ type CodeSentEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *CodeSentEvent) CheckPrevious() bool {
return false
}
func (e *CodeSentEvent) Data() interface{} {
return e
}

View File

@ -26,10 +26,6 @@ type ChangedEvent struct {
Gender human.Gender `json:"gender,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return true
}
func (e *ChangedEvent) Data() interface{} {
return e
}

View File

@ -23,10 +23,6 @@ type AddedEvent struct {
Description string `json:"description,omitempty"`
}
func (e *AddedEvent) CheckPrevious() bool {
return false
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -69,10 +65,6 @@ type ChangedEvent struct {
Description string `json:"description,omitempty"`
}
func (e *ChangedEvent) CheckPrevious() bool {
return false
}
func (e *ChangedEvent) Data() interface{} {
return e
}

View File

@ -24,10 +24,6 @@ type AddedEvent struct {
PublicKey []byte `json:"publicKey,omitempty"`
}
func (e *AddedEvent) CheckPrevious() bool {
return false
}
func (e *AddedEvent) Data() interface{} {
return e
}
@ -69,10 +65,6 @@ type RemovedEvent struct {
KeyID string `json:"keyId,omitempty"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return false
}
func (e *RemovedEvent) Data() interface{} {
return e
}