2021-01-04 13:52:13 +00:00
|
|
|
package query
|
|
|
|
|
|
|
|
import (
|
2021-02-23 14:13:04 +00:00
|
|
|
"github.com/caos/zitadel/internal/eventstore"
|
|
|
|
"github.com/caos/zitadel/internal/repository/iam"
|
|
|
|
"github.com/caos/zitadel/internal/repository/policy"
|
2021-01-04 13:52:13 +00:00
|
|
|
)
|
|
|
|
|
2021-08-11 06:36:32 +00:00
|
|
|
type IAMLockoutPolicyReadModel struct {
|
|
|
|
LockoutPolicyReadModel
|
2021-01-04 13:52:13 +00:00
|
|
|
}
|
|
|
|
|
2021-08-11 06:36:32 +00:00
|
|
|
func (rm *IAMLockoutPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
2021-01-04 13:52:13 +00:00
|
|
|
for _, event := range events {
|
|
|
|
switch e := event.(type) {
|
2021-08-11 06:36:32 +00:00
|
|
|
case *iam.LockoutPolicyAddedEvent:
|
|
|
|
rm.LockoutPolicyReadModel.AppendEvents(&e.LockoutPolicyAddedEvent)
|
|
|
|
case *iam.LockoutPolicyChangedEvent:
|
|
|
|
rm.LockoutPolicyReadModel.AppendEvents(&e.LockoutPolicyChangedEvent)
|
|
|
|
case *policy.LockoutPolicyAddedEvent, *policy.LockoutPolicyChangedEvent:
|
|
|
|
rm.LockoutPolicyReadModel.AppendEvents(e)
|
2021-01-04 13:52:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|