fix: move activity log to queries and remove old code (#3096)

* move changes to queries and remove old code

* fix changes query

* remove unused code

* fix sorting

* fix sorting

* refactor and remove old code

* remove accidental go.mod replace

* add missing file

* remove listDetail from ChangesResponse
This commit is contained in:
Livio Amstutz
2022-01-26 10:16:33 +01:00
committed by GitHub
parent 52da2354a3
commit e99b7f4972
100 changed files with 579 additions and 3565 deletions

View File

@@ -3,19 +3,17 @@ package eventsourcing
import (
"context"
"github.com/caos/zitadel/internal/crypto"
v1 "github.com/caos/zitadel/internal/eventstore/v1"
"github.com/caos/zitadel/internal/query"
"github.com/caos/zitadel/internal/api/authz"
"github.com/caos/zitadel/internal/authz/repository"
"github.com/caos/zitadel/internal/authz/repository/eventsourcing/eventstore"
"github.com/caos/zitadel/internal/authz/repository/eventsourcing/spooler"
authz_view "github.com/caos/zitadel/internal/authz/repository/eventsourcing/view"
sd "github.com/caos/zitadel/internal/config/systemdefaults"
"github.com/caos/zitadel/internal/config/types"
"github.com/caos/zitadel/internal/crypto"
v1 "github.com/caos/zitadel/internal/eventstore/v1"
es_spol "github.com/caos/zitadel/internal/eventstore/v1/spooler"
"github.com/caos/zitadel/internal/id"
"github.com/caos/zitadel/internal/query"
)
type Config struct {
@@ -26,11 +24,11 @@ type Config struct {
type EsRepository struct {
spooler *es_spol.Spooler
eventstore.UserGrantRepo
eventstore.UserMembershipRepo
eventstore.TokenVerifierRepo
}
func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, queries *query.Queries) (*EsRepository, error) {
func Start(conf Config, systemDefaults sd.SystemDefaults, queries *query.Queries) (repository.Repository, error) {
es, err := v1.Start(conf.Eventstore)
if err != nil {
return nil, err
@@ -56,16 +54,12 @@ func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, qu
return &EsRepository{
spool,
eventstore.UserGrantRepo{
View: view,
IamID: systemDefaults.IamID,
Auth: authZ,
Eventstore: es,
eventstore.UserMembershipRepo{
View: view,
},
eventstore.TokenVerifierRepo{
TokenVerificationKey: keyAlgorithm,
Eventstore: es,
IAMID: systemDefaults.IamID,
View: view,
Query: queries,
},
@@ -73,7 +67,7 @@ func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, qu
}
func (repo *EsRepository) Health(ctx context.Context) error {
if err := repo.UserGrantRepo.Health(); err != nil {
if err := repo.UserMembershipRepo.Health(); err != nil {
return err
}
return nil