fix: instance remove (#4602)

This commit is contained in:
Livio Spring
2022-10-26 15:06:48 +02:00
committed by GitHub
parent 001636f2b4
commit d721f725fd
89 changed files with 656 additions and 122 deletions

View File

@@ -17,6 +17,7 @@ import (
org_es_model "github.com/zitadel/zitadel/internal/org/repository/eventsourcing/model"
"github.com/zitadel/zitadel/internal/org/repository/view"
query2 "github.com/zitadel/zitadel/internal/query"
"github.com/zitadel/zitadel/internal/repository/instance"
"github.com/zitadel/zitadel/internal/repository/org"
"github.com/zitadel/zitadel/internal/repository/user"
view_model "github.com/zitadel/zitadel/internal/user/repository/view/model"
@@ -61,7 +62,7 @@ func (u *UserSession) Subscription() *v1.Subscription {
}
func (_ *UserSession) AggregateTypes() []models.AggregateType {
return []models.AggregateType{user.AggregateType, org.AggregateType}
return []models.AggregateType{user.AggregateType, org.AggregateType, instance.AggregateType}
}
func (u *UserSession) CurrentSequence(instanceID string) (uint64, error) {
@@ -153,6 +154,8 @@ func (u *UserSession) Reduce(event *models.Event) (err error) {
return u.fillLoginNamesOnOrgUsers(event)
case user.UserRemovedType:
return u.view.DeleteUserSessions(event.AggregateID, event.InstanceID, event)
case instance.InstanceRemovedEventType:
return u.view.DeleteInstanceUserSessions(event)
default:
return u.view.ProcessedUserSessionSequence(event)
}