* Changes added

* Reading of events for applications changed.

* Proto changed

* Tests added

* Added more tests.

* Struct for Data expanded with additional fields.

* refactoring

* Changes from review.

* Merge in to Master

* Changes from review.

* fix: generate proto

Co-authored-by: Fabiennne <fabienne.gerschwiler@gmail.com>
This commit is contained in:
Michael Waeger
2020-06-15 16:50:09 +02:00
committed by GitHub
parent 8dd6082b17
commit 1dd82ab1b7
36 changed files with 3833 additions and 3944 deletions

View File

@@ -2,9 +2,10 @@ package eventstore
import (
"context"
"strings"
"github.com/caos/zitadel/internal/api/auth"
"github.com/caos/zitadel/internal/model"
"strings"
"github.com/caos/zitadel/internal/errors"
mgmt_view "github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
@@ -45,6 +46,14 @@ func (repo *OrgRepository) ReactivateOrg(ctx context.Context, id string) (*org_m
return repo.OrgEventstore.ReactivateOrg(ctx, id)
}
func (repo *OrgRepository) OrgChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*org_model.OrgChanges, error) {
changes, err := repo.OrgEventstore.OrgChanges(ctx, id, lastSequence, limit)
if err != nil {
return nil, err
}
return changes, nil
}
func (repo *OrgRepository) OrgMemberByID(ctx context.Context, orgID, userID string) (member *org_model.OrgMember, err error) {
member = org_model.NewOrgMember(orgID, userID)
return repo.OrgEventstore.OrgMemberByIDs(ctx, member)

View File

@@ -2,9 +2,10 @@ package eventstore
import (
"context"
"strings"
"github.com/caos/zitadel/internal/api/auth"
global_model "github.com/caos/zitadel/internal/model"
"strings"
"github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
"github.com/caos/zitadel/internal/project/repository/view/model"
@@ -129,6 +130,14 @@ func (repo *ProjectRepo) SearchProjectRoles(ctx context.Context, request *proj_m
}, nil
}
func (repo *ProjectRepo) ProjectChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*proj_model.ProjectChanges, error) {
changes, err := repo.ProjectEvents.ProjectChanges(ctx, id, lastSequence, limit)
if err != nil {
return nil, err
}
return changes, nil
}
func (repo *ProjectRepo) ApplicationByID(ctx context.Context, projectID, appID string) (app *proj_model.Application, err error) {
return repo.ProjectEvents.ApplicationByIDs(ctx, projectID, appID)
}
@@ -168,6 +177,14 @@ func (repo *ProjectRepo) SearchApplications(ctx context.Context, request *proj_m
}, nil
}
func (repo *ProjectRepo) ApplicationChanges(ctx context.Context, id string, appId string, lastSequence uint64, limit uint64) (*proj_model.ApplicationChanges, error) {
changes, err := repo.ProjectEvents.ApplicationChanges(ctx, id, appId, lastSequence, limit)
if err != nil {
return nil, err
}
return changes, nil
}
func (repo *ProjectRepo) ChangeOIDCConfig(ctx context.Context, config *proj_model.OIDCConfig) (*proj_model.OIDCConfig, error) {
return repo.ProjectEvents.ChangeOIDCConfig(ctx, config)
}

View File

@@ -2,6 +2,7 @@ package eventstore
import (
"context"
"github.com/caos/zitadel/internal/api/auth"
"github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
policy_event "github.com/caos/zitadel/internal/policy/repository/eventsourcing"
@@ -71,6 +72,14 @@ func (repo *UserRepo) SearchUsers(ctx context.Context, request *usr_model.UserSe
}, nil
}
func (repo *UserRepo) UserChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*usr_model.UserChanges, error) {
changes, err := repo.UserEvents.UserChanges(ctx, id, lastSequence, limit)
if err != nil {
return nil, err
}
return changes, nil
}
func (repo *UserRepo) GetGlobalUserByEmail(ctx context.Context, email string) (*usr_model.UserView, error) {
user, err := repo.View.GetGlobalUserByEmail(email)
if err != nil {

View File

@@ -2,6 +2,7 @@ package eventsourcing
import (
"context"
es_iam "github.com/caos/zitadel/internal/iam/repository/eventsourcing"
sd "github.com/caos/zitadel/internal/config/systemdefaults"
@@ -87,7 +88,6 @@ func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string) (*EsRe
if err != nil {
return nil, err
}
eventstoreRepos := handler.EventstoreRepos{ProjectEvents: project, UserEvents: user, OrgEvents: org}
spool := spooler.StartSpooler(conf.Spooler, es, view, sqlClient, eventstoreRepos)