diff --git a/cmd/zitadel/main.go b/cmd/zitadel/main.go index 09e591c739..a292edcfab 100644 --- a/cmd/zitadel/main.go +++ b/cmd/zitadel/main.go @@ -3,10 +3,11 @@ package main import ( "context" "flag" + "github.com/caos/zitadel/internal/eventstore/v1" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/query" metrics "github.com/caos/zitadel/internal/telemetry/metrics/config" - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/query" "github.com/caos/logging" @@ -22,7 +23,6 @@ import ( authz_repo "github.com/caos/zitadel/internal/authz/repository/eventsourcing" "github.com/caos/zitadel/internal/config" sd "github.com/caos/zitadel/internal/config/systemdefaults" - es_int "github.com/caos/zitadel/internal/eventstore" mgmt_es "github.com/caos/zitadel/internal/management/repository/eventsourcing" "github.com/caos/zitadel/internal/notification" "github.com/caos/zitadel/internal/setup" @@ -53,7 +53,7 @@ type Config struct { type setupConfig struct { Log logging.Config - Eventstore es_int.Config + Eventstore v1.Config SystemDefaults sd.SystemDefaults SetUp setup.IAMSetUp } @@ -98,7 +98,7 @@ func startZitadel(configPaths []string) { ctx := context.Background() //TODO: new eventstore config for command sie - es, err := es_int.Start(conf.Admin.Eventstore) + es, err := v1.Start(conf.Admin.Eventstore) if err != nil { return } @@ -179,7 +179,7 @@ func startSetup(configPaths []string, localDevMode bool) { ctx := context.Background() - es, err := es_int.Start(conf.Eventstore) + es, err := v1.Start(conf.Eventstore) logging.Log("MAIN-Ddt3").OnError(err).Fatal("cannot start eventstore") commands, err := command.StartCommandSide(&command.Config{ diff --git a/internal/admin/repository/eventsourcing/eventstore/iam.go b/internal/admin/repository/eventsourcing/eventstore/iam.go index af5a038db9..ce16efc228 100644 --- a/internal/admin/repository/eventsourcing/eventstore/iam.go +++ b/internal/admin/repository/eventsourcing/eventstore/iam.go @@ -2,11 +2,11 @@ package eventstore import ( "context" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_view "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" - "github.com/caos/zitadel/internal/v2/domain" "strings" caos_errs "github.com/caos/zitadel/internal/errors" @@ -21,7 +21,7 @@ import ( ) type IAMRepository struct { - Eventstore eventstore.Eventstore + Eventstore v1.Eventstore SearchLimit uint64 View *admin_view.View SystemDefaults systemdefaults.SystemDefaults diff --git a/internal/admin/repository/eventsourcing/eventstore/org.go b/internal/admin/repository/eventsourcing/eventstore/org.go index d8031e70e2..300e043ea9 100644 --- a/internal/admin/repository/eventsourcing/eventstore/org.go +++ b/internal/admin/repository/eventsourcing/eventstore/org.go @@ -3,8 +3,9 @@ package eventstore import ( "context" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/eventstore/v1" + "github.com/caos/zitadel/internal/eventstore/v1/models" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_model "github.com/caos/zitadel/internal/iam/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" "github.com/caos/zitadel/internal/org/repository/view" @@ -13,14 +14,13 @@ import ( "github.com/caos/logging" admin_view "github.com/caos/zitadel/internal/admin/repository/eventsourcing/view" "github.com/caos/zitadel/internal/config/systemdefaults" - "github.com/caos/zitadel/internal/eventstore" iam_es_model "github.com/caos/zitadel/internal/iam/repository/view/model" org_model "github.com/caos/zitadel/internal/org/model" "github.com/caos/zitadel/internal/org/repository/view/model" ) type OrgRepo struct { - Eventstore eventstore.Eventstore + Eventstore v1.Eventstore View *admin_view.View diff --git a/internal/admin/repository/eventsourcing/handler/handler.go b/internal/admin/repository/eventsourcing/handler/handler.go index 40c125c21e..2d61c7be06 100644 --- a/internal/admin/repository/eventsourcing/handler/handler.go +++ b/internal/admin/repository/eventsourcing/handler/handler.go @@ -1,13 +1,13 @@ package handler import ( + "github.com/caos/zitadel/internal/eventstore/v1" "time" "github.com/caos/zitadel/internal/admin/repository/eventsourcing/view" "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/config/types" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/query" + "github.com/caos/zitadel/internal/eventstore/v1/query" ) type Configs map[string]*Config @@ -22,14 +22,14 @@ type handler struct { cycleDuration time.Duration errorCountUntilSkip uint64 - es eventstore.Eventstore + es v1.Eventstore } -func (h *handler) Eventstore() eventstore.Eventstore { +func (h *handler) Eventstore() v1.Eventstore { return h.es } -func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es eventstore.Eventstore, defaults systemdefaults.SystemDefaults) []query.Handler { +func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es v1.Eventstore, defaults systemdefaults.SystemDefaults) []query.Handler { return []query.Handler{ newOrg( handler{view, bulkLimit, configs.cycleDuration("Org"), errorCount, es}), diff --git a/internal/admin/repository/eventsourcing/handler/iam_member.go b/internal/admin/repository/eventsourcing/handler/iam_member.go index 58ca23e7e3..f46a361650 100644 --- a/internal/admin/repository/eventsourcing/handler/iam_member.go +++ b/internal/admin/repository/eventsourcing/handler/iam_member.go @@ -3,15 +3,14 @@ package handler import ( "context" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/user/repository/view" view_model "github.com/caos/zitadel/internal/user/repository/view/model" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" usr_model "github.com/caos/zitadel/internal/user/model" @@ -24,7 +23,7 @@ const ( type IAMMember struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newIAMMember(handler handler) *IAMMember { @@ -199,7 +198,7 @@ func (m *IAMMember) getUserByID(userID string) (*view_model.UserView, error) { return &userCopy, nil } -func (m *IAMMember) getUserEvents(userID string, sequence uint64) ([]*models.Event, error) { +func (m *IAMMember) getUserEvents(userID string, sequence uint64) ([]*es_models.Event, error) { query, err := view.UserByIDQuery(userID, sequence) if err != nil { return nil, err diff --git a/internal/admin/repository/eventsourcing/handler/idp_config.go b/internal/admin/repository/eventsourcing/handler/idp_config.go index 7368b5f4ce..5cfceb017d 100644 --- a/internal/admin/repository/eventsourcing/handler/idp_config.go +++ b/internal/admin/repository/eventsourcing/handler/idp_config.go @@ -2,10 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -17,7 +17,7 @@ const ( type IDPConfig struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newIDPConfig(handler handler) *IDPConfig { diff --git a/internal/admin/repository/eventsourcing/handler/idp_providers.go b/internal/admin/repository/eventsourcing/handler/idp_providers.go index 38cc64fe5d..e3941aec3e 100644 --- a/internal/admin/repository/eventsourcing/handler/idp_providers.go +++ b/internal/admin/repository/eventsourcing/handler/idp_providers.go @@ -2,19 +2,19 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/eventstore/v1" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_view "github.com/caos/zitadel/internal/iam/repository/view" org_model "github.com/caos/zitadel/internal/org/model" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/logging" "github.com/caos/zitadel/internal/config/systemdefaults" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -28,7 +28,7 @@ const ( type IDPProvider struct { handler systemDefaults systemdefaults.SystemDefaults - subscription *eventstore.Subscription + subscription *v1.Subscription } func newIDPProvider( diff --git a/internal/admin/repository/eventsourcing/handler/label_policy.go b/internal/admin/repository/eventsourcing/handler/label_policy.go index 50bf98a2d2..ddcb632d35 100644 --- a/internal/admin/repository/eventsourcing/handler/label_policy.go +++ b/internal/admin/repository/eventsourcing/handler/label_policy.go @@ -2,10 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" ) @@ -16,7 +16,7 @@ const ( type LabelPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newLabelPolicy(handler handler) *LabelPolicy { diff --git a/internal/admin/repository/eventsourcing/handler/login_policy.go b/internal/admin/repository/eventsourcing/handler/login_policy.go index 90c6d15aba..7eb91ba2d9 100644 --- a/internal/admin/repository/eventsourcing/handler/login_policy.go +++ b/internal/admin/repository/eventsourcing/handler/login_policy.go @@ -3,17 +3,16 @@ package handler import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/iam/repository/eventsourcing" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -22,7 +21,7 @@ const ( type LoginPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newLoginPolicy(handler handler) *LoginPolicy { @@ -48,11 +47,11 @@ func (p *LoginPolicy) ViewModel() string { return loginPolicyTable } -func (p *LoginPolicy) AggregateTypes() []models.AggregateType { - return []models.AggregateType{iam_es_model.IAMAggregate, model.OrgAggregate} +func (p *LoginPolicy) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{iam_es_model.IAMAggregate, model.OrgAggregate} } -func (p *LoginPolicy) EventQuery() (*models.SearchQuery, error) { +func (p *LoginPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestLoginPolicySequence() if err != nil { return nil, err @@ -70,7 +69,7 @@ func (p *LoginPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *LoginPolicy) Reduce(event *models.Event) (err error) { +func (p *LoginPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = p.processLoginPolicy(event) @@ -78,7 +77,7 @@ func (p *LoginPolicy) Reduce(event *models.Event) (err error) { return err } -func (p *LoginPolicy) processLoginPolicy(event *models.Event) (err error) { +func (p *LoginPolicy) processLoginPolicy(event *es_models.Event) (err error) { policy := new(iam_model.LoginPolicyView) switch event.Type { case model.OrgAdded: @@ -132,7 +131,7 @@ func (p *LoginPolicy) processLoginPolicy(event *models.Event) (err error) { return p.view.PutLoginPolicy(policy, event) } -func (p *LoginPolicy) OnError(event *models.Event, err error) error { +func (p *LoginPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Wj8sf", "id", event.AggregateID).WithError(err).Warn("something went wrong in login policy handler") return spooler.HandleError(event, err, p.view.GetLatestLoginPolicyFailedEvent, p.view.ProcessedLoginPolicyFailedEvent, p.view.ProcessedLoginPolicySequence, p.errorCountUntilSkip) } @@ -162,7 +161,7 @@ func (p *LoginPolicy) getDefaultLoginPolicy() (*iam_model.LoginPolicyView, error return &policyCopy, nil } -func (p *LoginPolicy) getIAMEvents(sequence uint64) ([]*models.Event, error) { +func (p *LoginPolicy) getIAMEvents(sequence uint64) ([]*es_models.Event, error) { query, err := eventsourcing.IAMByIDQuery(domain.IAMID, sequence) if err != nil { return nil, err diff --git a/internal/admin/repository/eventsourcing/handler/mail_template.go b/internal/admin/repository/eventsourcing/handler/mail_template.go index c140ba1022..6117449f43 100644 --- a/internal/admin/repository/eventsourcing/handler/mail_template.go +++ b/internal/admin/repository/eventsourcing/handler/mail_template.go @@ -2,12 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -15,7 +14,7 @@ import ( type MailTemplate struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newMailTemplate(handler handler) *MailTemplate { @@ -57,7 +56,7 @@ func (p *MailTemplate) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *MailTemplate) EventQuery() (*models.SearchQuery, error) { +func (m *MailTemplate) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestMailTemplateSequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (m *MailTemplate) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *MailTemplate) Reduce(event *models.Event) (err error) { +func (m *MailTemplate) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.IAMAggregate: err = m.processMailTemplate(event) @@ -75,7 +74,7 @@ func (m *MailTemplate) Reduce(event *models.Event) (err error) { return err } -func (m *MailTemplate) processMailTemplate(event *models.Event) (err error) { +func (m *MailTemplate) processMailTemplate(event *es_models.Event) (err error) { template := new(iam_model.MailTemplateView) switch event.Type { case model.MailTemplateAdded: @@ -95,7 +94,7 @@ func (m *MailTemplate) processMailTemplate(event *models.Event) (err error) { return m.view.PutMailTemplate(template, event) } -func (m *MailTemplate) OnError(event *models.Event, err error) error { +func (m *MailTemplate) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Wj8sf", "id", event.AggregateID).WithError(err).Warn("something went wrong in label template handler") return spooler.HandleError(event, err, m.view.GetLatestMailTemplateFailedEvent, m.view.ProcessedMailTemplateFailedEvent, m.view.ProcessedMailTemplateSequence, m.errorCountUntilSkip) } diff --git a/internal/admin/repository/eventsourcing/handler/mail_text.go b/internal/admin/repository/eventsourcing/handler/mail_text.go index 6462bd54db..7656fbc1b9 100644 --- a/internal/admin/repository/eventsourcing/handler/mail_text.go +++ b/internal/admin/repository/eventsourcing/handler/mail_text.go @@ -2,12 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -15,7 +14,7 @@ import ( type MailText struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newMailText(handler handler) *MailText { @@ -57,7 +56,7 @@ func (p *MailText) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *MailText) EventQuery() (*models.SearchQuery, error) { +func (m *MailText) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestMailTextSequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (m *MailText) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *MailText) Reduce(event *models.Event) (err error) { +func (m *MailText) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.IAMAggregate: err = m.processMailText(event) @@ -75,7 +74,7 @@ func (m *MailText) Reduce(event *models.Event) (err error) { return err } -func (m *MailText) processMailText(event *models.Event) (err error) { +func (m *MailText) processMailText(event *es_models.Event) (err error) { mailText := new(iam_model.MailTextView) switch event.Type { case model.MailTextAdded: @@ -99,7 +98,7 @@ func (m *MailText) processMailText(event *models.Event) (err error) { return m.view.PutMailText(mailText, event) } -func (m *MailText) OnError(event *models.Event, err error) error { +func (m *MailText) OnError(event *es_models.Event, err error) error { logging.LogWithFields("HANDL-5jk84", "id", event.AggregateID).WithError(err).Warn("something went wrong in label mailText handler") return spooler.HandleError(event, err, m.view.GetLatestMailTextFailedEvent, m.view.ProcessedMailTextFailedEvent, m.view.ProcessedMailTextSequence, m.errorCountUntilSkip) } diff --git a/internal/admin/repository/eventsourcing/handler/org.go b/internal/admin/repository/eventsourcing/handler/org.go index 8f2da5ca7a..7b7026da77 100644 --- a/internal/admin/repository/eventsourcing/handler/org.go +++ b/internal/admin/repository/eventsourcing/handler/org.go @@ -2,12 +2,12 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/repository/view/model" ) @@ -18,7 +18,7 @@ const ( type Org struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrg(handler handler) *Org { diff --git a/internal/admin/repository/eventsourcing/handler/org_iam_policy.go b/internal/admin/repository/eventsourcing/handler/org_iam_policy.go index 660a0a25a3..d1beeab5f9 100644 --- a/internal/admin/repository/eventsourcing/handler/org_iam_policy.go +++ b/internal/admin/repository/eventsourcing/handler/org_iam_policy.go @@ -2,10 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -17,7 +17,7 @@ const ( type OrgIAMPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrgIAMPolicy(handler handler) *OrgIAMPolicy { diff --git a/internal/admin/repository/eventsourcing/handler/password_age_policy.go b/internal/admin/repository/eventsourcing/handler/password_age_policy.go index 692d5a578c..d1a0be0d12 100644 --- a/internal/admin/repository/eventsourcing/handler/password_age_policy.go +++ b/internal/admin/repository/eventsourcing/handler/password_age_policy.go @@ -2,13 +2,12 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) @@ -19,7 +18,7 @@ const ( type PasswordAgePolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newPasswordAgePolicy(handler handler) *PasswordAgePolicy { @@ -45,8 +44,8 @@ func (p *PasswordAgePolicy) ViewModel() string { return passwordAgePolicyTable } -func (p *PasswordAgePolicy) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} +func (p *PasswordAgePolicy) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} } func (p *PasswordAgePolicy) CurrentSequence() (uint64, error) { @@ -57,7 +56,7 @@ func (p *PasswordAgePolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *PasswordAgePolicy) EventQuery() (*models.SearchQuery, error) { +func (p *PasswordAgePolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestPasswordAgePolicySequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (p *PasswordAgePolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (p *PasswordAgePolicy) Reduce(event *models.Event) (err error) { +func (p *PasswordAgePolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = p.processPasswordAgePolicy(event) @@ -75,7 +74,7 @@ func (p *PasswordAgePolicy) Reduce(event *models.Event) (err error) { return err } -func (p *PasswordAgePolicy) processPasswordAgePolicy(event *models.Event) (err error) { +func (p *PasswordAgePolicy) processPasswordAgePolicy(event *es_models.Event) (err error) { policy := new(iam_model.PasswordAgePolicyView) switch event.Type { case iam_es_model.PasswordAgePolicyAdded, model.PasswordAgePolicyAdded: @@ -97,7 +96,7 @@ func (p *PasswordAgePolicy) processPasswordAgePolicy(event *models.Event) (err e return p.view.PutPasswordAgePolicy(policy, event) } -func (p *PasswordAgePolicy) OnError(event *models.Event, err error) error { +func (p *PasswordAgePolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-nD8sie", "id", event.AggregateID).WithError(err).Warn("something went wrong in passwordAge policy handler") return spooler.HandleError(event, err, p.view.GetLatestPasswordAgePolicyFailedEvent, p.view.ProcessedPasswordAgePolicyFailedEvent, p.view.ProcessedPasswordAgePolicySequence, p.errorCountUntilSkip) } diff --git a/internal/admin/repository/eventsourcing/handler/password_complexity_policy.go b/internal/admin/repository/eventsourcing/handler/password_complexity_policy.go index 2408af543f..221325ead0 100644 --- a/internal/admin/repository/eventsourcing/handler/password_complexity_policy.go +++ b/internal/admin/repository/eventsourcing/handler/password_complexity_policy.go @@ -2,13 +2,12 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) @@ -19,7 +18,7 @@ const ( type PasswordComplexityPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newPasswordComplexityPolicy(handler handler) *PasswordComplexityPolicy { @@ -45,8 +44,8 @@ func (p *PasswordComplexityPolicy) ViewModel() string { return passwordComplexityPolicyTable } -func (p *PasswordComplexityPolicy) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} +func (p *PasswordComplexityPolicy) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} } func (p *PasswordComplexityPolicy) CurrentSequence() (uint64, error) { @@ -57,7 +56,7 @@ func (p *PasswordComplexityPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *PasswordComplexityPolicy) EventQuery() (*models.SearchQuery, error) { +func (p *PasswordComplexityPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestPasswordComplexityPolicySequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (p *PasswordComplexityPolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (p *PasswordComplexityPolicy) Reduce(event *models.Event) (err error) { +func (p *PasswordComplexityPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = p.processPasswordComplexityPolicy(event) @@ -75,7 +74,7 @@ func (p *PasswordComplexityPolicy) Reduce(event *models.Event) (err error) { return err } -func (p *PasswordComplexityPolicy) processPasswordComplexityPolicy(event *models.Event) (err error) { +func (p *PasswordComplexityPolicy) processPasswordComplexityPolicy(event *es_models.Event) (err error) { policy := new(iam_model.PasswordComplexityPolicyView) switch event.Type { case iam_es_model.PasswordComplexityPolicyAdded, model.PasswordComplexityPolicyAdded: @@ -97,7 +96,7 @@ func (p *PasswordComplexityPolicy) processPasswordComplexityPolicy(event *models return p.view.PutPasswordComplexityPolicy(policy, event) } -func (p *PasswordComplexityPolicy) OnError(event *models.Event, err error) error { +func (p *PasswordComplexityPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Wm8fs", "id", event.AggregateID).WithError(err).Warn("something went wrong in passwordComplexity policy handler") return spooler.HandleError(event, err, p.view.GetLatestPasswordComplexityPolicyFailedEvent, p.view.ProcessedPasswordComplexityPolicyFailedEvent, p.view.ProcessedPasswordComplexityPolicySequence, p.errorCountUntilSkip) } diff --git a/internal/admin/repository/eventsourcing/handler/password_lockout_policy.go b/internal/admin/repository/eventsourcing/handler/password_lockout_policy.go index 979dba7b89..d04a507724 100644 --- a/internal/admin/repository/eventsourcing/handler/password_lockout_policy.go +++ b/internal/admin/repository/eventsourcing/handler/password_lockout_policy.go @@ -2,13 +2,12 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) @@ -19,7 +18,7 @@ const ( type PasswordLockoutPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newPasswordLockoutPolicy(handler handler) *PasswordLockoutPolicy { @@ -45,8 +44,8 @@ func (p *PasswordLockoutPolicy) ViewModel() string { return passwordLockoutPolicyTable } -func (p *PasswordLockoutPolicy) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} +func (p *PasswordLockoutPolicy) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} } func (p *PasswordLockoutPolicy) CurrentSequence() (uint64, error) { @@ -57,7 +56,7 @@ func (p *PasswordLockoutPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *PasswordLockoutPolicy) EventQuery() (*models.SearchQuery, error) { +func (p *PasswordLockoutPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestPasswordLockoutPolicySequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (p *PasswordLockoutPolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (p *PasswordLockoutPolicy) Reduce(event *models.Event) (err error) { +func (p *PasswordLockoutPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = p.processPasswordLockoutPolicy(event) @@ -75,7 +74,7 @@ func (p *PasswordLockoutPolicy) Reduce(event *models.Event) (err error) { return err } -func (p *PasswordLockoutPolicy) processPasswordLockoutPolicy(event *models.Event) (err error) { +func (p *PasswordLockoutPolicy) processPasswordLockoutPolicy(event *es_models.Event) (err error) { policy := new(iam_model.PasswordLockoutPolicyView) switch event.Type { case iam_es_model.PasswordLockoutPolicyAdded, model.PasswordLockoutPolicyAdded: @@ -97,7 +96,7 @@ func (p *PasswordLockoutPolicy) processPasswordLockoutPolicy(event *models.Event return p.view.PutPasswordLockoutPolicy(policy, event) } -func (p *PasswordLockoutPolicy) OnError(event *models.Event, err error) error { +func (p *PasswordLockoutPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-nD8sie", "id", event.AggregateID).WithError(err).Warn("something went wrong in passwordLockout policy handler") return spooler.HandleError(event, err, p.view.GetLatestPasswordLockoutPolicyFailedEvent, p.view.ProcessedPasswordLockoutPolicyFailedEvent, p.view.ProcessedPasswordLockoutPolicySequence, p.errorCountUntilSkip) } diff --git a/internal/admin/repository/eventsourcing/handler/user.go b/internal/admin/repository/eventsourcing/handler/user.go index 1dd8146410..89d658ae86 100644 --- a/internal/admin/repository/eventsourcing/handler/user.go +++ b/internal/admin/repository/eventsourcing/handler/user.go @@ -3,22 +3,21 @@ package handler import ( "context" "github.com/caos/zitadel/internal/config/systemdefaults" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/eventstore/v1" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/v2/domain" "k8s.io/apimachinery/pkg/api/errors" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" org_model "github.com/caos/zitadel/internal/org/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" @@ -31,9 +30,9 @@ const ( type User struct { handler - eventstore eventstore.Eventstore + eventstore v1.Eventstore systemDefaults systemdefaults.SystemDefaults - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUser( @@ -63,8 +62,8 @@ func (u *User) ViewModel() string { return userTable } -func (u *User) AggregateTypes() []models.AggregateType { - return []models.AggregateType{es_model.UserAggregate, org_es_model.OrgAggregate} +func (u *User) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{es_model.UserAggregate, org_es_model.OrgAggregate} } func (u *User) CurrentSequence() (uint64, error) { @@ -75,7 +74,7 @@ func (u *User) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (u *User) EventQuery() (*models.SearchQuery, error) { +func (u *User) EventQuery() (*es_models.SearchQuery, error) { sequence, err := u.view.GetLatestUserSequence() if err != nil { return nil, err @@ -85,7 +84,7 @@ func (u *User) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (u *User) Reduce(event *models.Event) (err error) { +func (u *User) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case es_model.UserAggregate: return u.ProcessUser(event) @@ -96,7 +95,7 @@ func (u *User) Reduce(event *models.Event) (err error) { } } -func (u *User) ProcessUser(event *models.Event) (err error) { +func (u *User) ProcessUser(event *es_models.Event) (err error) { user := new(view_model.UserView) switch event.Type { case es_model.UserAdded, @@ -167,7 +166,7 @@ func (u *User) ProcessUser(event *models.Event) (err error) { return u.view.PutUser(user, event) } -func (u *User) ProcessOrg(event *models.Event) (err error) { +func (u *User) ProcessOrg(event *es_models.Event) (err error) { switch event.Type { case org_es_model.OrgDomainVerified, org_es_model.OrgDomainRemoved, @@ -182,7 +181,7 @@ func (u *User) ProcessOrg(event *models.Event) (err error) { } } -func (u *User) fillLoginNamesOnOrgUsers(event *models.Event) error { +func (u *User) fillLoginNamesOnOrgUsers(event *es_models.Event) error { org, err := u.getOrgByID(context.Background(), event.ResourceOwner) if err != nil { return err @@ -204,7 +203,7 @@ func (u *User) fillLoginNamesOnOrgUsers(event *models.Event) error { return u.view.PutUsers(users, event) } -func (u *User) fillPreferredLoginNamesOnOrgUsers(event *models.Event) error { +func (u *User) fillPreferredLoginNamesOnOrgUsers(event *es_models.Event) error { org, err := u.getOrgByID(context.Background(), event.ResourceOwner) if err != nil { return err @@ -247,7 +246,7 @@ func (u *User) fillLoginNames(user *view_model.UserView) (err error) { return nil } -func (u *User) OnError(event *models.Event, err error) error { +func (u *User) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-vLmwQ", "id", event.AggregateID).WithError(err).Warn("something went wrong in user handler") return spooler.HandleError(event, err, u.view.GetLatestUserFailedEvent, u.view.ProcessedUserFailedEvent, u.view.ProcessedUserSequence, u.errorCountUntilSkip) } @@ -263,7 +262,7 @@ func (u *User) getOrgByID(ctx context.Context, orgID string) (*org_model.Org, er } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } @@ -284,7 +283,7 @@ func (u *User) getIAMByID(ctx context.Context) (*iam_model.IAM, error) { return nil, err } iam := &model.IAM{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: domain.IAMID, }, } diff --git a/internal/admin/repository/eventsourcing/handler/user_external_idps.go b/internal/admin/repository/eventsourcing/handler/user_external_idps.go index 8bc1a62c88..536dad8d77 100644 --- a/internal/admin/repository/eventsourcing/handler/user_external_idps.go +++ b/internal/admin/repository/eventsourcing/handler/user_external_idps.go @@ -4,13 +4,13 @@ import ( "context" "github.com/caos/logging" "github.com/caos/zitadel/internal/config/systemdefaults" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" @@ -20,7 +20,6 @@ import ( "github.com/caos/zitadel/internal/org/repository/view" "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" usr_view_model "github.com/caos/zitadel/internal/user/repository/view/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -30,7 +29,7 @@ const ( type ExternalIDP struct { handler systemDefaults systemdefaults.SystemDefaults - subscription *eventstore.Subscription + subscription *v1.Subscription } func newExternalIDP( @@ -60,8 +59,8 @@ func (i *ExternalIDP) ViewModel() string { return externalIDPTable } -func (i *ExternalIDP) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.UserAggregate, iam_es_model.IAMAggregate, org_es_model.OrgAggregate} +func (i *ExternalIDP) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.UserAggregate, iam_es_model.IAMAggregate, org_es_model.OrgAggregate} } func (i *ExternalIDP) CurrentSequence() (uint64, error) { @@ -72,7 +71,7 @@ func (i *ExternalIDP) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (i *ExternalIDP) EventQuery() (*models.SearchQuery, error) { +func (i *ExternalIDP) EventQuery() (*es_models.SearchQuery, error) { sequence, err := i.view.GetLatestExternalIDPSequence() if err != nil { return nil, err @@ -82,7 +81,7 @@ func (i *ExternalIDP) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (i *ExternalIDP) Reduce(event *models.Event) (err error) { +func (i *ExternalIDP) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.UserAggregate: err = i.processUser(event) @@ -92,7 +91,7 @@ func (i *ExternalIDP) Reduce(event *models.Event) (err error) { return err } -func (i *ExternalIDP) processUser(event *models.Event) (err error) { +func (i *ExternalIDP) processUser(event *es_models.Event) (err error) { externalIDP := new(usr_view_model.ExternalIDPView) switch event.Type { case model.HumanExternalIDPAdded: @@ -118,7 +117,7 @@ func (i *ExternalIDP) processUser(event *models.Event) (err error) { return i.view.PutExternalIDP(externalIDP, event) } -func (i *ExternalIDP) processIdpConfig(event *models.Event) (err error) { +func (i *ExternalIDP) processIdpConfig(event *es_models.Event) (err error) { switch event.Type { case iam_es_model.IDPConfigChanged, org_es_model.IDPConfigChanged: configView := new(iam_view_model.IDPConfigView) @@ -165,7 +164,7 @@ func (i *ExternalIDP) fillConfigData(externalIDP *usr_view_model.ExternalIDPView externalIDP.IDPName = config.Name } -func (i *ExternalIDP) OnError(event *models.Event, err error) error { +func (i *ExternalIDP) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-4Rsu8", "id", event.AggregateID).WithError(err).Warn("something went wrong in idp provider handler") return spooler.HandleError(event, err, i.view.GetLatestExternalIDPFailedEvent, i.view.ProcessedExternalIDPFailedEvent, i.view.ProcessedExternalIDPSequence, i.errorCountUntilSkip) } @@ -192,7 +191,7 @@ func (i *ExternalIDP) getOrgByID(ctx context.Context, orgID string) (*org_model. } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } diff --git a/internal/admin/repository/eventsourcing/repository.go b/internal/admin/repository/eventsourcing/repository.go index 185ffa6a2a..aab8199c20 100644 --- a/internal/admin/repository/eventsourcing/repository.go +++ b/internal/admin/repository/eventsourcing/repository.go @@ -7,13 +7,13 @@ import ( admin_view "github.com/caos/zitadel/internal/admin/repository/eventsourcing/view" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/config/types" - es_int "github.com/caos/zitadel/internal/eventstore" - es_spol "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_spol "github.com/caos/zitadel/internal/eventstore/v1/spooler" ) type Config struct { SearchLimit uint64 - Eventstore es_int.Config + Eventstore v1.Config View types.SQL Spooler spooler.SpoolerConfig Domain string @@ -27,7 +27,7 @@ type EsRepository struct { } func Start(ctx context.Context, conf Config, systemDefaults sd.SystemDefaults, roles []string) (*EsRepository, error) { - es, err := es_int.Start(conf.Eventstore) + es, err := v1.Start(conf.Eventstore) if err != nil { return nil, err } diff --git a/internal/admin/repository/eventsourcing/spooler/lock.go b/internal/admin/repository/eventsourcing/spooler/lock.go index f07b190c1c..f1440f79af 100644 --- a/internal/admin/repository/eventsourcing/spooler/lock.go +++ b/internal/admin/repository/eventsourcing/spooler/lock.go @@ -2,7 +2,7 @@ package spooler import ( "database/sql" - es_locker "github.com/caos/zitadel/internal/eventstore/locker" + es_locker "github.com/caos/zitadel/internal/eventstore/v1/locker" "time" ) diff --git a/internal/admin/repository/eventsourcing/spooler/spooler.go b/internal/admin/repository/eventsourcing/spooler/spooler.go index 3ab4e2628d..7679b5e078 100644 --- a/internal/admin/repository/eventsourcing/spooler/spooler.go +++ b/internal/admin/repository/eventsourcing/spooler/spooler.go @@ -3,11 +3,11 @@ package spooler import ( "database/sql" "github.com/caos/zitadel/internal/config/systemdefaults" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/admin/repository/eventsourcing/handler" "github.com/caos/zitadel/internal/admin/repository/eventsourcing/view" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" ) type SpoolerConfig struct { @@ -17,7 +17,7 @@ type SpoolerConfig struct { Handlers handler.Configs } -func StartSpooler(c SpoolerConfig, es eventstore.Eventstore, view *view.View, sql *sql.DB, defaults systemdefaults.SystemDefaults) *spooler.Spooler { +func StartSpooler(c SpoolerConfig, es v1.Eventstore, view *view.View, sql *sql.DB, defaults systemdefaults.SystemDefaults) *spooler.Spooler { spoolerConfig := spooler.Config{ Eventstore: es, Locker: &locker{dbClient: sql}, diff --git a/internal/admin/repository/eventsourcing/view/external_idps.go b/internal/admin/repository/eventsourcing/view/external_idps.go index f211f1006b..d4cffd2557 100644 --- a/internal/admin/repository/eventsourcing/view/external_idps.go +++ b/internal/admin/repository/eventsourcing/view/external_idps.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/admin/repository/eventsourcing/view/iam_member.go b/internal/admin/repository/eventsourcing/view/iam_member.go index 21cc782b6d..2bd4e2fa7e 100644 --- a/internal/admin/repository/eventsourcing/view/iam_member.go +++ b/internal/admin/repository/eventsourcing/view/iam_member.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" diff --git a/internal/admin/repository/eventsourcing/view/idp_configs.go b/internal/admin/repository/eventsourcing/view/idp_configs.go index deb4e688cc..785f080546 100644 --- a/internal/admin/repository/eventsourcing/view/idp_configs.go +++ b/internal/admin/repository/eventsourcing/view/idp_configs.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" diff --git a/internal/admin/repository/eventsourcing/view/idp_providers.go b/internal/admin/repository/eventsourcing/view/idp_providers.go index 7d0ef141fb..2739ef9afe 100644 --- a/internal/admin/repository/eventsourcing/view/idp_providers.go +++ b/internal/admin/repository/eventsourcing/view/idp_providers.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" diff --git a/internal/admin/repository/eventsourcing/view/label_policies.go b/internal/admin/repository/eventsourcing/view/label_policies.go index 761fc2c62f..aafb8f9d84 100644 --- a/internal/admin/repository/eventsourcing/view/label_policies.go +++ b/internal/admin/repository/eventsourcing/view/label_policies.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/admin/repository/eventsourcing/view/login_policies.go b/internal/admin/repository/eventsourcing/view/login_policies.go index f4eb8914b8..257bbddf3e 100644 --- a/internal/admin/repository/eventsourcing/view/login_policies.go +++ b/internal/admin/repository/eventsourcing/view/login_policies.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/admin/repository/eventsourcing/view/mail_templates.go b/internal/admin/repository/eventsourcing/view/mail_templates.go index a6ec850ab8..8cc6f8cebd 100644 --- a/internal/admin/repository/eventsourcing/view/mail_templates.go +++ b/internal/admin/repository/eventsourcing/view/mail_templates.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/admin/repository/eventsourcing/view/mail_texts.go b/internal/admin/repository/eventsourcing/view/mail_texts.go index 89d67fea6d..21aa83b90d 100644 --- a/internal/admin/repository/eventsourcing/view/mail_texts.go +++ b/internal/admin/repository/eventsourcing/view/mail_texts.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/admin/repository/eventsourcing/view/org.go b/internal/admin/repository/eventsourcing/view/org.go index a5d2d45ab2..781d2e5a3c 100644 --- a/internal/admin/repository/eventsourcing/view/org.go +++ b/internal/admin/repository/eventsourcing/view/org.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" org_model "github.com/caos/zitadel/internal/org/model" org_view "github.com/caos/zitadel/internal/org/repository/view" "github.com/caos/zitadel/internal/org/repository/view/model" diff --git a/internal/admin/repository/eventsourcing/view/org_iam_policy.go b/internal/admin/repository/eventsourcing/view/org_iam_policy.go index 5e77383407..f9470821d4 100644 --- a/internal/admin/repository/eventsourcing/view/org_iam_policy.go +++ b/internal/admin/repository/eventsourcing/view/org_iam_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/admin/repository/eventsourcing/view/password_age_policy.go b/internal/admin/repository/eventsourcing/view/password_age_policy.go index 02fe19db3c..0d3a5c8293 100644 --- a/internal/admin/repository/eventsourcing/view/password_age_policy.go +++ b/internal/admin/repository/eventsourcing/view/password_age_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/admin/repository/eventsourcing/view/password_complexity_policy.go b/internal/admin/repository/eventsourcing/view/password_complexity_policy.go index 9d7e315e04..46d95c93aa 100644 --- a/internal/admin/repository/eventsourcing/view/password_complexity_policy.go +++ b/internal/admin/repository/eventsourcing/view/password_complexity_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/admin/repository/eventsourcing/view/password_lockout_policy.go b/internal/admin/repository/eventsourcing/view/password_lockout_policy.go index 6076320aea..081bb984fb 100644 --- a/internal/admin/repository/eventsourcing/view/password_lockout_policy.go +++ b/internal/admin/repository/eventsourcing/view/password_lockout_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/admin/repository/eventsourcing/view/sequence.go b/internal/admin/repository/eventsourcing/view/sequence.go index 358e2daf61..5486ba1dd4 100644 --- a/internal/admin/repository/eventsourcing/view/sequence.go +++ b/internal/admin/repository/eventsourcing/view/sequence.go @@ -3,7 +3,7 @@ package view import ( "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/view/repository" ) diff --git a/internal/admin/repository/eventsourcing/view/user.go b/internal/admin/repository/eventsourcing/view/user.go index 3a5c8d064c..31fc70df5b 100644 --- a/internal/admin/repository/eventsourcing/view/user.go +++ b/internal/admin/repository/eventsourcing/view/user.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/api/api.go b/internal/api/api.go index 01e74389d4..ef12ff5f63 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -4,9 +4,9 @@ import ( "context" admin_es "github.com/caos/zitadel/internal/admin/repository/eventsourcing" auth_es "github.com/caos/zitadel/internal/auth/repository/eventsourcing" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/telemetry/metrics" "github.com/caos/zitadel/internal/telemetry/metrics/otel" - "github.com/caos/zitadel/internal/v2/domain" view_model "github.com/caos/zitadel/internal/view/model" "go.opentelemetry.io/otel/api/metric" "net/http" diff --git a/internal/api/grpc/admin/iam_member_converter.go b/internal/api/grpc/admin/iam_member_converter.go index 9dba233b84..bd4fac8b86 100644 --- a/internal/api/grpc/admin/iam_member_converter.go +++ b/internal/api/grpc/admin/iam_member_converter.go @@ -2,7 +2,7 @@ package admin import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/admin/idp_config_converter.go b/internal/api/grpc/admin/idp_config_converter.go index 6db7939554..533d69fe27 100644 --- a/internal/api/grpc/admin/idp_config_converter.go +++ b/internal/api/grpc/admin/idp_config_converter.go @@ -2,9 +2,9 @@ package admin import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/admin/label_policy_converter.go b/internal/api/grpc/admin/label_policy_converter.go index 14e15ea3a1..164df5ebcd 100644 --- a/internal/api/grpc/admin/label_policy_converter.go +++ b/internal/api/grpc/admin/label_policy_converter.go @@ -2,8 +2,8 @@ package admin import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/admin/login_policy_converter.go b/internal/api/grpc/admin/login_policy_converter.go index b0cdd5136e..30fd414c11 100644 --- a/internal/api/grpc/admin/login_policy_converter.go +++ b/internal/api/grpc/admin/login_policy_converter.go @@ -2,8 +2,8 @@ package admin import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/admin/org_converter.go b/internal/api/grpc/admin/org_converter.go index 8dd42aba26..d9751e1849 100644 --- a/internal/api/grpc/admin/org_converter.go +++ b/internal/api/grpc/admin/org_converter.go @@ -5,10 +5,10 @@ import ( "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/model" org_model "github.com/caos/zitadel/internal/org/model" usr_model "github.com/caos/zitadel/internal/user/model" diff --git a/internal/api/grpc/admin/password_age_policy_converter.go b/internal/api/grpc/admin/password_age_policy_converter.go index 8f3769b769..b332412240 100644 --- a/internal/api/grpc/admin/password_age_policy_converter.go +++ b/internal/api/grpc/admin/password_age_policy_converter.go @@ -2,8 +2,8 @@ package admin import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/admin/password_complexity_policy_converter.go b/internal/api/grpc/admin/password_complexity_policy_converter.go index 9527d52c34..0b5580ae9d 100644 --- a/internal/api/grpc/admin/password_complexity_policy_converter.go +++ b/internal/api/grpc/admin/password_complexity_policy_converter.go @@ -2,8 +2,8 @@ package admin import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/admin/password_lockout_policy_converter.go b/internal/api/grpc/admin/password_lockout_policy_converter.go index 24794a6345..6bd7125ef7 100644 --- a/internal/api/grpc/admin/password_lockout_policy_converter.go +++ b/internal/api/grpc/admin/password_lockout_policy_converter.go @@ -2,8 +2,8 @@ package admin import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/admin/server.go b/internal/api/grpc/admin/server.go index 41e69e0c69..47c5bcfbc1 100644 --- a/internal/api/grpc/admin/server.go +++ b/internal/api/grpc/admin/server.go @@ -1,8 +1,8 @@ package admin import ( - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/query" "google.golang.org/grpc" "github.com/caos/zitadel/internal/admin/repository" diff --git a/internal/api/grpc/admin/template_converter.go b/internal/api/grpc/admin/template_converter.go index c42414593f..20fe1aa22a 100644 --- a/internal/api/grpc/admin/template_converter.go +++ b/internal/api/grpc/admin/template_converter.go @@ -1,8 +1,8 @@ package admin import ( + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/internal/api/grpc/admin/text_converter.go b/internal/api/grpc/admin/text_converter.go index cca6bc616d..298eb08c06 100644 --- a/internal/api/grpc/admin/text_converter.go +++ b/internal/api/grpc/admin/text_converter.go @@ -1,8 +1,8 @@ package admin import ( + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/internal/api/grpc/admin/user_converter.go b/internal/api/grpc/admin/user_converter.go index 4a53a08571..adc2f7ec3d 100644 --- a/internal/api/grpc/admin/user_converter.go +++ b/internal/api/grpc/admin/user_converter.go @@ -2,9 +2,9 @@ package admin import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/admin" "golang.org/x/text/language" ) diff --git a/internal/api/grpc/auth/server.go b/internal/api/grpc/auth/server.go index 30a53159b0..6f081d5a19 100644 --- a/internal/api/grpc/auth/server.go +++ b/internal/api/grpc/auth/server.go @@ -1,8 +1,8 @@ package auth import ( - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/query" "google.golang.org/grpc" "github.com/caos/zitadel/internal/api/authz" diff --git a/internal/api/grpc/auth/user_converter.go b/internal/api/grpc/auth/user_converter.go index c10a4c06e8..c206b6e097 100644 --- a/internal/api/grpc/auth/user_converter.go +++ b/internal/api/grpc/auth/user_converter.go @@ -10,10 +10,10 @@ import ( "google.golang.org/protobuf/types/known/structpb" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/telemetry/tracing" usr_model "github.com/caos/zitadel/internal/user/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/auth" "github.com/caos/zitadel/pkg/grpc/message" ) diff --git a/internal/api/grpc/management/application_converter.go b/internal/api/grpc/management/application_converter.go index 294268a16b..3051fb82e8 100644 --- a/internal/api/grpc/management/application_converter.go +++ b/internal/api/grpc/management/application_converter.go @@ -11,11 +11,11 @@ import ( "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" key_model "github.com/caos/zitadel/internal/key/model" "github.com/caos/zitadel/internal/model" proj_model "github.com/caos/zitadel/internal/project/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" "github.com/caos/zitadel/pkg/grpc/message" ) diff --git a/internal/api/grpc/management/iam_converter.go b/internal/api/grpc/management/iam_converter.go index 75a001ac9d..0daa146aef 100644 --- a/internal/api/grpc/management/iam_converter.go +++ b/internal/api/grpc/management/iam_converter.go @@ -1,8 +1,8 @@ package management import ( + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" ) diff --git a/internal/api/grpc/management/idp_config_converter.go b/internal/api/grpc/management/idp_config_converter.go index d344c38629..ceff826107 100644 --- a/internal/api/grpc/management/idp_config_converter.go +++ b/internal/api/grpc/management/idp_config_converter.go @@ -6,10 +6,10 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/api/authz" + "github.com/caos/zitadel/internal/domain" caos_errors "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/management/login_policy_converter.go b/internal/api/grpc/management/login_policy_converter.go index 824274fd69..f948cfc216 100644 --- a/internal/api/grpc/management/login_policy_converter.go +++ b/internal/api/grpc/management/login_policy_converter.go @@ -8,9 +8,9 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" ) diff --git a/internal/api/grpc/management/mail_template_converter.go b/internal/api/grpc/management/mail_template_converter.go index 8f2958f5fc..7784decebb 100644 --- a/internal/api/grpc/management/mail_template_converter.go +++ b/internal/api/grpc/management/mail_template_converter.go @@ -1,8 +1,8 @@ package management import ( + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/internal/api/grpc/management/mail_text_converter.go b/internal/api/grpc/management/mail_text_converter.go index 7a5b2f5ebb..9ba8a36f44 100644 --- a/internal/api/grpc/management/mail_text_converter.go +++ b/internal/api/grpc/management/mail_text_converter.go @@ -2,8 +2,8 @@ package management import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/management/org_converter.go b/internal/api/grpc/management/org_converter.go index e0b7305fdd..29c698117b 100644 --- a/internal/api/grpc/management/org_converter.go +++ b/internal/api/grpc/management/org_converter.go @@ -7,9 +7,9 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/logging" "github.com/golang/protobuf/ptypes" diff --git a/internal/api/grpc/management/org_member_converter.go b/internal/api/grpc/management/org_member_converter.go index c7445b9fc3..d39fe08e2b 100644 --- a/internal/api/grpc/management/org_member_converter.go +++ b/internal/api/grpc/management/org_member_converter.go @@ -8,9 +8,9 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/caos/zitadel/internal/api/authz" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/model" org_model "github.com/caos/zitadel/internal/org/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" ) diff --git a/internal/api/grpc/management/password_age_policy_converter.go b/internal/api/grpc/management/password_age_policy_converter.go index a0f531ee4b..1656a81aa1 100644 --- a/internal/api/grpc/management/password_age_policy_converter.go +++ b/internal/api/grpc/management/password_age_policy_converter.go @@ -5,9 +5,9 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/management/password_complexity_policy_converter.go b/internal/api/grpc/management/password_complexity_policy_converter.go index eacdff599d..a745d1e386 100644 --- a/internal/api/grpc/management/password_complexity_policy_converter.go +++ b/internal/api/grpc/management/password_complexity_policy_converter.go @@ -5,9 +5,9 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/management/password_lockout_policy_converter.go b/internal/api/grpc/management/password_lockout_policy_converter.go index 7fb8950bab..2c9c59cf3f 100644 --- a/internal/api/grpc/management/password_lockout_policy_converter.go +++ b/internal/api/grpc/management/password_lockout_policy_converter.go @@ -5,9 +5,9 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/internal/api/grpc/management/project_converter.go b/internal/api/grpc/management/project_converter.go index 9dbfcce553..896d8efee7 100644 --- a/internal/api/grpc/management/project_converter.go +++ b/internal/api/grpc/management/project_converter.go @@ -2,7 +2,7 @@ package management import ( "encoding/json" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "google.golang.org/protobuf/types/known/timestamppb" "github.com/caos/logging" @@ -10,7 +10,7 @@ import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/types/known/structpb" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/pkg/grpc/management" "github.com/caos/zitadel/pkg/grpc/message" diff --git a/internal/api/grpc/management/project_grant_converter.go b/internal/api/grpc/management/project_grant_converter.go index 359ec8f114..e43487d793 100644 --- a/internal/api/grpc/management/project_grant_converter.go +++ b/internal/api/grpc/management/project_grant_converter.go @@ -2,12 +2,12 @@ package management import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "google.golang.org/protobuf/types/known/timestamppb" "github.com/golang/protobuf/ptypes" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/model" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/pkg/grpc/management" diff --git a/internal/api/grpc/management/project_grant_member_converter.go b/internal/api/grpc/management/project_grant_member_converter.go index ce675d86d6..a406947745 100644 --- a/internal/api/grpc/management/project_grant_member_converter.go +++ b/internal/api/grpc/management/project_grant_member_converter.go @@ -2,12 +2,12 @@ package management import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/pkg/grpc/management" ) diff --git a/internal/api/grpc/management/project_member_converter.go b/internal/api/grpc/management/project_member_converter.go index c8a708c8ee..0b610669a0 100644 --- a/internal/api/grpc/management/project_member_converter.go +++ b/internal/api/grpc/management/project_member_converter.go @@ -2,11 +2,11 @@ package management import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/pkg/grpc/management" ) diff --git a/internal/api/grpc/management/server.go b/internal/api/grpc/management/server.go index 7e9aad842d..554ade9d90 100644 --- a/internal/api/grpc/management/server.go +++ b/internal/api/grpc/management/server.go @@ -1,8 +1,8 @@ package management import ( - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/query" "google.golang.org/grpc" "github.com/caos/zitadel/internal/api/authz" diff --git a/internal/api/grpc/management/user_converter.go b/internal/api/grpc/management/user_converter.go index 0638f78669..7abffb66d8 100644 --- a/internal/api/grpc/management/user_converter.go +++ b/internal/api/grpc/management/user_converter.go @@ -10,9 +10,9 @@ import ( "google.golang.org/protobuf/types/known/structpb" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/model" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/pkg/grpc/management" diff --git a/internal/api/grpc/management/user_grant_converter.go b/internal/api/grpc/management/user_grant_converter.go index 7feddcd31a..664c28feac 100644 --- a/internal/api/grpc/management/user_grant_converter.go +++ b/internal/api/grpc/management/user_grant_converter.go @@ -2,11 +2,11 @@ package management import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" grant_model "github.com/caos/zitadel/internal/usergrant/model" "github.com/caos/zitadel/pkg/grpc/management" ) diff --git a/internal/api/grpc/management/user_human_converter.go b/internal/api/grpc/management/user_human_converter.go index 7bd67b6fec..0bfad70425 100644 --- a/internal/api/grpc/management/user_human_converter.go +++ b/internal/api/grpc/management/user_human_converter.go @@ -2,8 +2,8 @@ package management import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" usr_model "github.com/caos/zitadel/internal/user/model" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/pkg/grpc/management" "github.com/golang/protobuf/ptypes" "golang.org/x/text/language" diff --git a/internal/api/grpc/management/user_machine_converter.go b/internal/api/grpc/management/user_machine_converter.go index ab0c565b73..a03240ef09 100644 --- a/internal/api/grpc/management/user_machine_converter.go +++ b/internal/api/grpc/management/user_machine_converter.go @@ -6,12 +6,12 @@ import ( "time" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "github.com/caos/logging" "github.com/golang/protobuf/ptypes" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" key_model "github.com/caos/zitadel/internal/key/model" "github.com/caos/zitadel/internal/model" usr_model "github.com/caos/zitadel/internal/user/model" diff --git a/internal/api/oidc/auth_request_converter.go b/internal/api/oidc/auth_request_converter.go index f891bf0be4..6a3fc44298 100644 --- a/internal/api/oidc/auth_request_converter.go +++ b/internal/api/oidc/auth_request_converter.go @@ -2,7 +2,7 @@ package oidc import ( "context" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net" "time" diff --git a/internal/api/oidc/op.go b/internal/api/oidc/op.go index b57fe78ea1..fc3949714e 100644 --- a/internal/api/oidc/op.go +++ b/internal/api/oidc/op.go @@ -10,12 +10,12 @@ import ( http_utils "github.com/caos/zitadel/internal/api/http" "github.com/caos/zitadel/internal/api/http/middleware" "github.com/caos/zitadel/internal/auth/repository" + "github.com/caos/zitadel/internal/command" "github.com/caos/zitadel/internal/config/types" "github.com/caos/zitadel/internal/id" + "github.com/caos/zitadel/internal/query" "github.com/caos/zitadel/internal/telemetry/metrics" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/query" ) type OPHandlerConfig struct { diff --git a/internal/auth/repository/auth_request.go b/internal/auth/repository/auth_request.go index 1899c9f14a..bd67df7d65 100644 --- a/internal/auth/repository/auth_request.go +++ b/internal/auth/repository/auth_request.go @@ -2,7 +2,7 @@ package repository import ( "context" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) type AuthRequestRepository interface { diff --git a/internal/auth/repository/eventsourcing/eventstore/application.go b/internal/auth/repository/eventsourcing/eventstore/application.go index c623892040..39d5a9eaf7 100644 --- a/internal/auth/repository/eventsourcing/eventstore/application.go +++ b/internal/auth/repository/eventsourcing/eventstore/application.go @@ -4,10 +4,10 @@ import ( "context" "github.com/caos/zitadel/internal/auth/repository/eventsourcing/view" + "github.com/caos/zitadel/internal/command" "github.com/caos/zitadel/internal/project/model" proj_view_model "github.com/caos/zitadel/internal/project/repository/view/model" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/command" ) type ApplicationRepo struct { diff --git a/internal/auth/repository/eventsourcing/eventstore/auth_request.go b/internal/auth/repository/eventsourcing/eventstore/auth_request.go index a4aa8129bd..04dd09015e 100644 --- a/internal/auth/repository/eventsourcing/eventstore/auth_request.go +++ b/internal/auth/repository/eventsourcing/eventstore/auth_request.go @@ -2,8 +2,8 @@ package eventstore import ( "context" - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/domain" "time" "github.com/caos/logging" @@ -14,7 +14,7 @@ import ( auth_req_model "github.com/caos/zitadel/internal/auth_request/model" cache "github.com/caos/zitadel/internal/auth_request/repository" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/view/model" iam_view_model "github.com/caos/zitadel/internal/iam/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/eventstore/auth_request_test.go b/internal/auth/repository/eventsourcing/eventstore/auth_request_test.go index 02798c3dac..87fdb00cac 100644 --- a/internal/auth/repository/eventsourcing/eventstore/auth_request_test.go +++ b/internal/auth/repository/eventsourcing/eventstore/auth_request_test.go @@ -3,7 +3,7 @@ package eventstore import ( "context" "encoding/json" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "testing" "time" @@ -16,7 +16,7 @@ import ( "github.com/caos/zitadel/internal/auth_request/model" "github.com/caos/zitadel/internal/auth_request/repository/cache" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" org_model "github.com/caos/zitadel/internal/org/model" org_view_model "github.com/caos/zitadel/internal/org/repository/view/model" proj_view_model "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/eventstore/iam.go b/internal/auth/repository/eventsourcing/eventstore/iam.go index 43230e345e..b438b7eafc 100644 --- a/internal/auth/repository/eventsourcing/eventstore/iam.go +++ b/internal/auth/repository/eventsourcing/eventstore/iam.go @@ -2,7 +2,7 @@ package eventstore import ( "context" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/query" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/auth/repository/eventsourcing/eventstore/key.go b/internal/auth/repository/eventsourcing/eventstore/key.go index 1c608b9751..3f6c4ed8dd 100644 --- a/internal/auth/repository/eventsourcing/eventstore/key.go +++ b/internal/auth/repository/eventsourcing/eventstore/key.go @@ -2,6 +2,7 @@ package eventstore import ( "context" + "github.com/caos/zitadel/internal/eventstore" "os" "time" @@ -9,14 +10,13 @@ import ( "gopkg.in/square/go-jose.v2" "github.com/caos/zitadel/internal/auth/repository/eventsourcing/view" + "github.com/caos/zitadel/internal/command" "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/spooler" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/id" "github.com/caos/zitadel/internal/key/model" key_view "github.com/caos/zitadel/internal/key/repository/view" - "github.com/caos/zitadel/internal/v2/command" ) type KeyRepository struct { diff --git a/internal/auth/repository/eventsourcing/eventstore/token.go b/internal/auth/repository/eventsourcing/eventstore/token.go index 4b22947688..765903228c 100644 --- a/internal/auth/repository/eventsourcing/eventstore/token.go +++ b/internal/auth/repository/eventsourcing/eventstore/token.go @@ -2,10 +2,10 @@ package eventstore import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "time" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_view "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/logging" @@ -18,7 +18,7 @@ import ( ) type TokenRepo struct { - Eventstore eventstore.Eventstore + Eventstore v1.Eventstore View *view.View } diff --git a/internal/auth/repository/eventsourcing/eventstore/user.go b/internal/auth/repository/eventsourcing/eventstore/user.go index d428136173..99c915db50 100644 --- a/internal/auth/repository/eventsourcing/eventstore/user.go +++ b/internal/auth/repository/eventsourcing/eventstore/user.go @@ -2,7 +2,7 @@ package eventstore import ( "context" - es_models "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/golang/protobuf/ptypes" "github.com/caos/zitadel/internal/config/systemdefaults" @@ -13,8 +13,7 @@ import ( "github.com/caos/zitadel/internal/api/authz" "github.com/caos/zitadel/internal/auth/repository/eventsourcing/view" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" key_view_model "github.com/caos/zitadel/internal/key/repository/view/model" "github.com/caos/zitadel/internal/telemetry/tracing" "github.com/caos/zitadel/internal/user/model" @@ -24,7 +23,7 @@ import ( type UserRepo struct { SearchLimit uint64 - Eventstore eventstore.Eventstore + Eventstore v1.Eventstore View *view.View SystemDefaults systemdefaults.SystemDefaults } @@ -163,7 +162,7 @@ func (repo *UserRepo) UserByID(ctx context.Context, id string) (*model.UserView, return usr_view_model.UserToModel(&userCopy), nil } -func (repo *UserRepo) UserEventsByID(ctx context.Context, id string, sequence uint64) ([]*es_models.Event, error) { +func (repo *UserRepo) UserEventsByID(ctx context.Context, id string, sequence uint64) ([]*models.Event, error) { return repo.getUserEvents(ctx, id, sequence) } diff --git a/internal/auth/repository/eventsourcing/handler/application.go b/internal/auth/repository/eventsourcing/handler/application.go index 68dbf4a832..3b56bc67a5 100644 --- a/internal/auth/repository/eventsourcing/handler/application.go +++ b/internal/auth/repository/eventsourcing/handler/application.go @@ -2,15 +2,15 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" proj_model "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" proj_view "github.com/caos/zitadel/internal/project/repository/view" @@ -23,7 +23,7 @@ const ( type Application struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newApplication(handler handler) *Application { diff --git a/internal/auth/repository/eventsourcing/handler/authn_keys.go b/internal/auth/repository/eventsourcing/handler/authn_keys.go index 0300b6b1b3..f7a2fdf69a 100644 --- a/internal/auth/repository/eventsourcing/handler/authn_keys.go +++ b/internal/auth/repository/eventsourcing/handler/authn_keys.go @@ -1,14 +1,14 @@ package handler import ( + "github.com/caos/zitadel/internal/eventstore/v1" "time" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" key_model "github.com/caos/zitadel/internal/key/repository/view/model" proj_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" user_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" @@ -20,7 +20,7 @@ const ( type AuthNKeys struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newAuthNKeys(handler handler) *AuthNKeys { diff --git a/internal/auth/repository/eventsourcing/handler/handler.go b/internal/auth/repository/eventsourcing/handler/handler.go index 927a1f3c49..07d4736fa1 100644 --- a/internal/auth/repository/eventsourcing/handler/handler.go +++ b/internal/auth/repository/eventsourcing/handler/handler.go @@ -1,13 +1,13 @@ package handler import ( + "github.com/caos/zitadel/internal/eventstore/v1" "time" "github.com/caos/zitadel/internal/auth/repository/eventsourcing/view" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/config/types" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/query" + "github.com/caos/zitadel/internal/eventstore/v1/query" key_model "github.com/caos/zitadel/internal/key/model" ) @@ -23,14 +23,14 @@ type handler struct { cycleDuration time.Duration errorCountUntilSkip uint64 - es eventstore.Eventstore + es v1.Eventstore } -func (h *handler) Eventstore() eventstore.Eventstore { +func (h *handler) Eventstore() v1.Eventstore { return h.es } -func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es eventstore.Eventstore, systemDefaults sd.SystemDefaults, keyChan chan<- *key_model.KeyView) []query.Handler { +func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es v1.Eventstore, systemDefaults sd.SystemDefaults, keyChan chan<- *key_model.KeyView) []query.Handler { return []query.Handler{ newUser( handler{view, bulkLimit, configs.cycleDuration("User"), errorCount, es}, diff --git a/internal/auth/repository/eventsourcing/handler/idp_config.go b/internal/auth/repository/eventsourcing/handler/idp_config.go index d11ee66219..498479cd77 100644 --- a/internal/auth/repository/eventsourcing/handler/idp_config.go +++ b/internal/auth/repository/eventsourcing/handler/idp_config.go @@ -2,11 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -19,7 +18,7 @@ const ( type IDPConfig struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newIDPConfig(h handler) *IDPConfig { @@ -45,8 +44,8 @@ func (i *IDPConfig) ViewModel() string { return idpConfigTable } -func (_ *IDPConfig) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} +func (_ *IDPConfig) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} } func (i *IDPConfig) CurrentSequence() (uint64, error) { @@ -57,7 +56,7 @@ func (i *IDPConfig) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (i *IDPConfig) EventQuery() (*models.SearchQuery, error) { +func (i *IDPConfig) EventQuery() (*es_models.SearchQuery, error) { sequence, err := i.view.GetLatestIDPConfigSequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (i *IDPConfig) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (i *IDPConfig) Reduce(event *models.Event) (err error) { +func (i *IDPConfig) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate: err = i.processIdpConfig(iam_model.IDPProviderTypeOrg, event) @@ -77,7 +76,7 @@ func (i *IDPConfig) Reduce(event *models.Event) (err error) { return err } -func (i *IDPConfig) processIdpConfig(providerType iam_model.IDPProviderType, event *models.Event) (err error) { +func (i *IDPConfig) processIdpConfig(providerType iam_model.IDPProviderType, event *es_models.Event) (err error) { idp := new(iam_view_model.IDPConfigView) switch event.Type { case model.IDPConfigAdded, @@ -110,7 +109,7 @@ func (i *IDPConfig) processIdpConfig(providerType iam_model.IDPProviderType, eve return i.view.PutIDPConfig(idp, event) } -func (i *IDPConfig) OnError(event *models.Event, err error) error { +func (i *IDPConfig) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Ejf8s", "id", event.AggregateID).WithError(err).Warn("something went wrong in idp config handler") return spooler.HandleError(event, err, i.view.GetLatestIDPConfigFailedEvent, i.view.ProcessedIDPConfigFailedEvent, i.view.ProcessedIDPConfigSequence, i.errorCountUntilSkip) } diff --git a/internal/auth/repository/eventsourcing/handler/idp_providers.go b/internal/auth/repository/eventsourcing/handler/idp_providers.go index a4468d4ae6..e07c606074 100644 --- a/internal/auth/repository/eventsourcing/handler/idp_providers.go +++ b/internal/auth/repository/eventsourcing/handler/idp_providers.go @@ -2,22 +2,21 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/eventstore/v1" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_view "github.com/caos/zitadel/internal/iam/repository/view" org_model "github.com/caos/zitadel/internal/org/model" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/logging" "github.com/caos/zitadel/internal/config/systemdefaults" - "github.com/caos/zitadel/internal/eventstore" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -30,7 +29,7 @@ const ( type IDPProvider struct { handler systemDefaults systemdefaults.SystemDefaults - subscription *eventstore.Subscription + subscription *v1.Subscription } func newIDPProvider( @@ -60,8 +59,8 @@ func (i *IDPProvider) ViewModel() string { return idpProviderTable } -func (_ *IDPProvider) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.IAMAggregate, org_es_model.OrgAggregate} +func (_ *IDPProvider) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.IAMAggregate, org_es_model.OrgAggregate} } func (i *IDPProvider) CurrentSequence() (uint64, error) { @@ -72,7 +71,7 @@ func (i *IDPProvider) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (i *IDPProvider) EventQuery() (*models.SearchQuery, error) { +func (i *IDPProvider) EventQuery() (*es_models.SearchQuery, error) { sequence, err := i.view.GetLatestIDPProviderSequence() if err != nil { return nil, err @@ -82,7 +81,7 @@ func (i *IDPProvider) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (i *IDPProvider) Reduce(event *models.Event) (err error) { +func (i *IDPProvider) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.IAMAggregate, org_es_model.OrgAggregate: err = i.processIdpProvider(event) @@ -90,7 +89,7 @@ func (i *IDPProvider) Reduce(event *models.Event) (err error) { return err } -func (i *IDPProvider) processIdpProvider(event *models.Event) (err error) { +func (i *IDPProvider) processIdpProvider(event *es_models.Event) (err error) { provider := new(iam_view_model.IDPProviderView) switch event.Type { case model.LoginPolicyIDPProviderAdded, org_es_model.LoginPolicyIDPProviderAdded: @@ -162,7 +161,7 @@ func (i *IDPProvider) fillConfigData(provider *iam_view_model.IDPProviderView, c provider.IDPState = int32(config.State) } -func (i *IDPProvider) OnError(event *models.Event, err error) error { +func (i *IDPProvider) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Fjd89", "id", event.AggregateID).WithError(err).Warn("something went wrong in idp provider handler") return spooler.HandleError(event, err, i.view.GetLatestIDPProviderFailedEvent, i.view.ProcessedIDPProviderFailedEvent, i.view.ProcessedIDPProviderSequence, i.errorCountUntilSkip) } @@ -189,7 +188,7 @@ func (i *IDPProvider) getOrgByID(ctx context.Context, orgID string) (*org_model. } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } diff --git a/internal/auth/repository/eventsourcing/handler/key.go b/internal/auth/repository/eventsourcing/handler/key.go index e598dbfd1a..4c72a17334 100644 --- a/internal/auth/repository/eventsourcing/handler/key.go +++ b/internal/auth/repository/eventsourcing/handler/key.go @@ -1,14 +1,14 @@ package handler import ( + "github.com/caos/zitadel/internal/eventstore/v1" "time" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/key/model" "github.com/caos/zitadel/internal/key/repository/eventsourcing" es_model "github.com/caos/zitadel/internal/key/repository/eventsourcing/model" @@ -21,7 +21,7 @@ const ( type Key struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription keyChan chan<- *model.KeyView } diff --git a/internal/auth/repository/eventsourcing/handler/login_policy.go b/internal/auth/repository/eventsourcing/handler/login_policy.go index ac354a9568..3e577b7f4d 100644 --- a/internal/auth/repository/eventsourcing/handler/login_policy.go +++ b/internal/auth/repository/eventsourcing/handler/login_policy.go @@ -3,16 +3,15 @@ package handler import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/iam/repository/eventsourcing" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) @@ -23,7 +22,7 @@ const ( type LoginPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newLoginPolicy(handler handler) *LoginPolicy { @@ -49,8 +48,8 @@ func (p *LoginPolicy) ViewModel() string { return loginPolicyTable } -func (_ *LoginPolicy) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} +func (_ *LoginPolicy) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} } func (p *LoginPolicy) CurrentSequence() (uint64, error) { @@ -61,7 +60,7 @@ func (p *LoginPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *LoginPolicy) EventQuery() (*models.SearchQuery, error) { +func (p *LoginPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestLoginPolicySequence() if err != nil { return nil, err @@ -71,7 +70,7 @@ func (p *LoginPolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (p *LoginPolicy) Reduce(event *models.Event) (err error) { +func (p *LoginPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = p.processLoginPolicy(event) @@ -79,7 +78,7 @@ func (p *LoginPolicy) Reduce(event *models.Event) (err error) { return err } -func (p *LoginPolicy) processLoginPolicy(event *models.Event) (err error) { +func (p *LoginPolicy) processLoginPolicy(event *es_models.Event) (err error) { policy := new(iam_model.LoginPolicyView) switch event.Type { case model.OrgAdded: @@ -133,7 +132,7 @@ func (p *LoginPolicy) processLoginPolicy(event *models.Event) (err error) { return p.view.PutLoginPolicy(policy, event) } -func (p *LoginPolicy) OnError(event *models.Event, err error) error { +func (p *LoginPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-5id9s", "id", event.AggregateID).WithError(err).Warn("something went wrong in login policy handler") return spooler.HandleError(event, err, p.view.GetLatestLoginPolicyFailedEvent, p.view.ProcessedLoginPolicyFailedEvent, p.view.ProcessedLoginPolicySequence, p.errorCountUntilSkip) } @@ -163,7 +162,7 @@ func (p *LoginPolicy) getDefaultLoginPolicy() (*iam_model.LoginPolicyView, error return &policyCopy, nil } -func (p *LoginPolicy) getIAMEvents(sequence uint64) ([]*models.Event, error) { +func (p *LoginPolicy) getIAMEvents(sequence uint64) ([]*es_models.Event, error) { query, err := eventsourcing.IAMByIDQuery(domain.IAMID, sequence) if err != nil { return nil, err diff --git a/internal/auth/repository/eventsourcing/handler/org.go b/internal/auth/repository/eventsourcing/handler/org.go index 57272fb08c..a61251a878 100644 --- a/internal/auth/repository/eventsourcing/handler/org.go +++ b/internal/auth/repository/eventsourcing/handler/org.go @@ -2,12 +2,12 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/repository/view/model" ) @@ -18,7 +18,7 @@ const ( type Org struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrg(handler handler) *Org { diff --git a/internal/auth/repository/eventsourcing/handler/org_iam_policy.go b/internal/auth/repository/eventsourcing/handler/org_iam_policy.go index cfeae902f0..6fa4a729da 100644 --- a/internal/auth/repository/eventsourcing/handler/org_iam_policy.go +++ b/internal/auth/repository/eventsourcing/handler/org_iam_policy.go @@ -2,11 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -18,7 +18,7 @@ const ( type OrgIAMPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrgIAMPolicy(handler handler) *OrgIAMPolicy { diff --git a/internal/auth/repository/eventsourcing/handler/password_complexity_policy.go b/internal/auth/repository/eventsourcing/handler/password_complexity_policy.go index 5cb9a5267b..d3da621ea8 100644 --- a/internal/auth/repository/eventsourcing/handler/password_complexity_policy.go +++ b/internal/auth/repository/eventsourcing/handler/password_complexity_policy.go @@ -2,11 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -18,7 +18,7 @@ const ( type PasswordComplexityPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newPasswordComplexityPolicy(handler handler) *PasswordComplexityPolicy { diff --git a/internal/auth/repository/eventsourcing/handler/project_role.go b/internal/auth/repository/eventsourcing/handler/project_role.go index 13940d45a5..6c7f16c13f 100644 --- a/internal/auth/repository/eventsourcing/handler/project_role.go +++ b/internal/auth/repository/eventsourcing/handler/project_role.go @@ -2,11 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" proj_view "github.com/caos/zitadel/internal/project/repository/view" view_model "github.com/caos/zitadel/internal/project/repository/view/model" @@ -18,7 +18,7 @@ const ( type ProjectRole struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newProjectRole( diff --git a/internal/auth/repository/eventsourcing/handler/token.go b/internal/auth/repository/eventsourcing/handler/token.go index b35893893b..50de1ebbe6 100644 --- a/internal/auth/repository/eventsourcing/handler/token.go +++ b/internal/auth/repository/eventsourcing/handler/token.go @@ -3,17 +3,16 @@ package handler import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/logging" "k8s.io/apimachinery/pkg/api/errors" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" proj_model "github.com/caos/zitadel/internal/project/model" project_es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" proj_view "github.com/caos/zitadel/internal/project/repository/view" @@ -27,7 +26,7 @@ const ( type Token struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newToken( @@ -67,7 +66,7 @@ func (p *Token) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (t *Token) EventQuery() (*models.SearchQuery, error) { +func (t *Token) EventQuery() (*es_models.SearchQuery, error) { sequence, err := t.view.GetLatestTokenSequence() if err != nil { return nil, err @@ -77,7 +76,7 @@ func (t *Token) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (t *Token) Reduce(event *models.Event) (err error) { +func (t *Token) Reduce(event *es_models.Event) (err error) { switch event.Type { case user_es_model.UserTokenAdded: token := new(view_model.TokenView) @@ -132,12 +131,12 @@ func (t *Token) Reduce(event *models.Event) (err error) { } } -func (t *Token) OnError(event *models.Event, err error) error { +func (t *Token) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-3jkl4", "id", event.AggregateID).WithError(err).Warn("something went wrong in token handler") return spooler.HandleError(event, err, t.view.GetLatestTokenFailedEvent, t.view.ProcessedTokenFailedEvent, t.view.ProcessedTokenSequence, t.errorCountUntilSkip) } -func agentIDFromSession(event *models.Event) (string, error) { +func agentIDFromSession(event *es_models.Event) (string, error) { session := make(map[string]interface{}) if err := json.Unmarshal(event.Data, &session); err != nil { logging.Log("EVEN-s3bq9").WithError(err).Error("could not unmarshal event data") @@ -146,7 +145,7 @@ func agentIDFromSession(event *models.Event) (string, error) { return session["userAgentID"].(string), nil } -func applicationFromSession(event *models.Event) (*project_es_model.Application, error) { +func applicationFromSession(event *es_models.Event) (*project_es_model.Application, error) { application := new(project_es_model.Application) if err := json.Unmarshal(event.Data, &application); err != nil { logging.Log("EVEN-GRE2q").WithError(err).Error("could not unmarshal event data") @@ -165,7 +164,7 @@ func (t *Token) getProjectByID(ctx context.Context, projID string) (*proj_model. return nil, err } esProject := &project_es_model.Project{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: projID, }, } diff --git a/internal/auth/repository/eventsourcing/handler/user.go b/internal/auth/repository/eventsourcing/handler/user.go index 22bc9fed16..12c9582eab 100644 --- a/internal/auth/repository/eventsourcing/handler/user.go +++ b/internal/auth/repository/eventsourcing/handler/user.go @@ -3,13 +3,13 @@ package handler import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" @@ -18,7 +18,6 @@ import ( "github.com/caos/zitadel/internal/org/repository/view" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" view_model "github.com/caos/zitadel/internal/user/repository/view/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -28,7 +27,7 @@ const ( type User struct { handler iamID string - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUser( @@ -58,8 +57,8 @@ func (u *User) ViewModel() string { return userTable } -func (_ *User) AggregateTypes() []models.AggregateType { - return []models.AggregateType{es_model.UserAggregate, org_es_model.OrgAggregate} +func (_ *User) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{es_model.UserAggregate, org_es_model.OrgAggregate} } func (u *User) CurrentSequence() (uint64, error) { @@ -70,7 +69,7 @@ func (u *User) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (u *User) EventQuery() (*models.SearchQuery, error) { +func (u *User) EventQuery() (*es_models.SearchQuery, error) { sequence, err := u.view.GetLatestUserSequence() if err != nil { return nil, err @@ -80,7 +79,7 @@ func (u *User) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (u *User) Reduce(event *models.Event) (err error) { +func (u *User) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case es_model.UserAggregate: return u.ProcessUser(event) @@ -91,7 +90,7 @@ func (u *User) Reduce(event *models.Event) (err error) { } } -func (u *User) ProcessUser(event *models.Event) (err error) { +func (u *User) ProcessUser(event *es_models.Event) (err error) { user := new(view_model.UserView) switch event.Type { case es_model.UserAdded, @@ -183,7 +182,7 @@ func (u *User) fillLoginNames(user *view_model.UserView) (err error) { return nil } -func (u *User) ProcessOrg(event *models.Event) (err error) { +func (u *User) ProcessOrg(event *es_models.Event) (err error) { switch event.Type { case org_es_model.OrgDomainVerified, org_es_model.OrgDomainRemoved, @@ -198,7 +197,7 @@ func (u *User) ProcessOrg(event *models.Event) (err error) { } } -func (u *User) fillLoginNamesOnOrgUsers(event *models.Event) error { +func (u *User) fillLoginNamesOnOrgUsers(event *es_models.Event) error { org, err := u.getOrgByID(context.Background(), event.ResourceOwner) if err != nil { return err @@ -220,7 +219,7 @@ func (u *User) fillLoginNamesOnOrgUsers(event *models.Event) error { return u.view.PutUsers(users, event) } -func (u *User) fillPreferredLoginNamesOnOrgUsers(event *models.Event) error { +func (u *User) fillPreferredLoginNamesOnOrgUsers(event *es_models.Event) error { org, err := u.getOrgByID(context.Background(), event.ResourceOwner) if err != nil { return err @@ -245,7 +244,7 @@ func (u *User) fillPreferredLoginNamesOnOrgUsers(event *models.Event) error { return u.view.PutUsers(users, event) } -func (u *User) OnError(event *models.Event, err error) error { +func (u *User) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-is8aAWima", "id", event.AggregateID).WithError(err).Warn("something went wrong in user handler") return spooler.HandleError(event, err, u.view.GetLatestUserFailedEvent, u.view.ProcessedUserFailedEvent, u.view.ProcessedUserSequence, u.errorCountUntilSkip) } @@ -261,7 +260,7 @@ func (u *User) getOrgByID(ctx context.Context, orgID string) (*org_model.Org, er } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } @@ -282,7 +281,7 @@ func (u *User) getIAMByID(ctx context.Context) (*iam_model.IAM, error) { return nil, err } iam := &model.IAM{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: domain.IAMID, }, } diff --git a/internal/auth/repository/eventsourcing/handler/user_external_idps.go b/internal/auth/repository/eventsourcing/handler/user_external_idps.go index 7196c98b89..b3c4c17967 100644 --- a/internal/auth/repository/eventsourcing/handler/user_external_idps.go +++ b/internal/auth/repository/eventsourcing/handler/user_external_idps.go @@ -4,13 +4,13 @@ import ( "context" "github.com/caos/logging" "github.com/caos/zitadel/internal/config/systemdefaults" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" @@ -20,7 +20,6 @@ import ( "github.com/caos/zitadel/internal/org/repository/view" "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" usr_view_model "github.com/caos/zitadel/internal/user/repository/view/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -30,7 +29,7 @@ const ( type ExternalIDP struct { handler systemDefaults systemdefaults.SystemDefaults - subscription *eventstore.Subscription + subscription *v1.Subscription } func newExternalIDP( @@ -72,7 +71,7 @@ func (i *ExternalIDP) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (i *ExternalIDP) EventQuery() (*models.SearchQuery, error) { +func (i *ExternalIDP) EventQuery() (*es_models.SearchQuery, error) { sequence, err := i.view.GetLatestExternalIDPSequence() if err != nil { return nil, err @@ -82,7 +81,7 @@ func (i *ExternalIDP) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (i *ExternalIDP) Reduce(event *models.Event) (err error) { +func (i *ExternalIDP) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.UserAggregate: err = i.processUser(event) @@ -92,7 +91,7 @@ func (i *ExternalIDP) Reduce(event *models.Event) (err error) { return err } -func (i *ExternalIDP) processUser(event *models.Event) (err error) { +func (i *ExternalIDP) processUser(event *es_models.Event) (err error) { externalIDP := new(usr_view_model.ExternalIDPView) switch event.Type { case model.HumanExternalIDPAdded: @@ -118,7 +117,7 @@ func (i *ExternalIDP) processUser(event *models.Event) (err error) { return i.view.PutExternalIDP(externalIDP, event) } -func (i *ExternalIDP) processIdpConfig(event *models.Event) (err error) { +func (i *ExternalIDP) processIdpConfig(event *es_models.Event) (err error) { switch event.Type { case iam_es_model.IDPConfigChanged, org_es_model.IDPConfigChanged: configView := new(iam_view_model.IDPConfigView) @@ -166,7 +165,7 @@ func (i *ExternalIDP) fillConfigData(externalIDP *usr_view_model.ExternalIDPView externalIDP.IDPName = config.Name } -func (i *ExternalIDP) OnError(event *models.Event, err error) error { +func (i *ExternalIDP) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-4Rsu8", "id", event.AggregateID).WithError(err).Warn("something went wrong in idp provider handler") return spooler.HandleError(event, err, i.view.GetLatestExternalIDPFailedEvent, i.view.ProcessedExternalIDPFailedEvent, i.view.ProcessedExternalIDPSequence, i.errorCountUntilSkip) } @@ -193,7 +192,7 @@ func (i *ExternalIDP) getOrgByID(ctx context.Context, orgID string) (*org_model. } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } diff --git a/internal/auth/repository/eventsourcing/handler/user_grant.go b/internal/auth/repository/eventsourcing/handler/user_grant.go index c734e1f6e3..87885492d7 100644 --- a/internal/auth/repository/eventsourcing/handler/user_grant.go +++ b/internal/auth/repository/eventsourcing/handler/user_grant.go @@ -2,11 +2,12 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" iam_model "github.com/caos/zitadel/internal/iam/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" "strings" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" org_view "github.com/caos/zitadel/internal/org/repository/view" proj_view "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/user/repository/view" @@ -14,13 +15,12 @@ import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -30,7 +30,6 @@ import ( usr_es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" grant_es_model "github.com/caos/zitadel/internal/usergrant/repository/eventsourcing/model" view_model "github.com/caos/zitadel/internal/usergrant/repository/view/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -41,7 +40,7 @@ type UserGrant struct { handler iamID string iamProjectID string - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUserGrant( @@ -83,7 +82,7 @@ func (u *UserGrant) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (u *UserGrant) EventQuery() (*models.SearchQuery, error) { +func (u *UserGrant) EventQuery() (*es_models.SearchQuery, error) { if u.iamProjectID == "" { err := u.setIamProjectID() if err != nil { @@ -99,7 +98,7 @@ func (u *UserGrant) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (u *UserGrant) Reduce(event *models.Event) (err error) { +func (u *UserGrant) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case grant_es_model.UserGrantAggregate: err = u.processUserGrant(event) @@ -115,7 +114,7 @@ func (u *UserGrant) Reduce(event *models.Event) (err error) { return err } -func (u *UserGrant) processUserGrant(event *models.Event) (err error) { +func (u *UserGrant) processUserGrant(event *es_models.Event) (err error) { grant := new(view_model.UserGrantView) switch event.Type { case grant_es_model.UserGrantAdded: @@ -144,7 +143,7 @@ func (u *UserGrant) processUserGrant(event *models.Event) (err error) { return u.view.PutUserGrant(grant, event) } -func (u *UserGrant) processUser(event *models.Event) (err error) { +func (u *UserGrant) processUser(event *es_models.Event) (err error) { switch event.Type { case usr_es_model.UserProfileChanged, usr_es_model.UserEmailChanged, @@ -171,7 +170,7 @@ func (u *UserGrant) processUser(event *models.Event) (err error) { } } -func (u *UserGrant) processProject(event *models.Event) (err error) { +func (u *UserGrant) processProject(event *es_models.Event) (err error) { switch event.Type { case proj_es_model.ProjectChanged: grants, err := u.view.UserGrantsByProjectID(event.AggregateID) @@ -199,7 +198,7 @@ func (u *UserGrant) processProject(event *models.Event) (err error) { } } -func (u *UserGrant) processOrg(event *models.Event) (err error) { +func (u *UserGrant) processOrg(event *es_models.Event) (err error) { switch event.Type { case org_es_model.OrgMemberAdded, org_es_model.OrgMemberChanged, org_es_model.OrgMemberRemoved: member := new(org_es_model.OrgMember) @@ -210,7 +209,7 @@ func (u *UserGrant) processOrg(event *models.Event) (err error) { } } -func (u *UserGrant) processIAMMember(event *models.Event, rolePrefix string, suffix bool) error { +func (u *UserGrant) processIAMMember(event *es_models.Event, rolePrefix string, suffix bool) error { member := new(iam_es_model.IAMMember) switch event.Type { @@ -257,7 +256,7 @@ func (u *UserGrant) processIAMMember(event *models.Event, rolePrefix string, suf } } -func (u *UserGrant) processMember(event *models.Event, rolePrefix, roleSuffix string, userID string, roleKeys []string) error { +func (u *UserGrant) processMember(event *es_models.Event, rolePrefix, roleSuffix string, userID string, roleKeys []string) error { switch event.Type { case org_es_model.OrgMemberAdded, proj_es_model.ProjectMemberAdded, proj_es_model.ProjectGrantMemberAdded, org_es_model.OrgMemberChanged, proj_es_model.ProjectMemberChanged, proj_es_model.ProjectGrantMemberChanged: @@ -400,7 +399,7 @@ func (u *UserGrant) fillOrgData(grant *view_model.UserGrantView, org *org_model. } } -func (u *UserGrant) OnError(event *models.Event, err error) error { +func (u *UserGrant) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-UZmc7", "id", event.AggregateID).WithError(err).Warn("something went wrong in user grant handler") return spooler.HandleError(event, err, u.view.GetLatestUserGrantFailedEvent, u.view.ProcessedUserGrantFailedEvent, u.view.ProcessedUserGrantSequence, u.errorCountUntilSkip) } @@ -433,7 +432,7 @@ func (u *UserGrant) getUserByID(userID string) (*model.UserView, error) { return &userCopy, nil } -func (u *UserGrant) getUserEvents(userID string, sequence uint64) ([]*models.Event, error) { +func (u *UserGrant) getUserEvents(userID string, sequence uint64) ([]*es_models.Event, error) { query, err := view.UserByIDQuery(userID, sequence) if err != nil { return nil, err @@ -449,7 +448,7 @@ func (u *UserGrant) getOrgByID(ctx context.Context, orgID string) (*org_model.Or } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } @@ -470,7 +469,7 @@ func (u *UserGrant) getProjectByID(ctx context.Context, projID string) (*proj_mo return nil, err } esProject := &proj_es_model.Project{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: projID, }, } @@ -491,7 +490,7 @@ func (u *UserGrant) getIAMByID(ctx context.Context) (*iam_model.IAM, error) { return nil, err } iam := &iam_es_model.IAM{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: domain.IAMID, }, } diff --git a/internal/auth/repository/eventsourcing/handler/user_membership.go b/internal/auth/repository/eventsourcing/handler/user_membership.go index 654c6387d5..717988082e 100644 --- a/internal/auth/repository/eventsourcing/handler/user_membership.go +++ b/internal/auth/repository/eventsourcing/handler/user_membership.go @@ -2,16 +2,15 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -30,7 +29,7 @@ const ( type UserMembership struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUserMembership( @@ -70,7 +69,7 @@ func (m *UserMembership) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *UserMembership) EventQuery() (*models.SearchQuery, error) { +func (m *UserMembership) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestUserMembershipSequence() if err != nil { return nil, err @@ -80,7 +79,7 @@ func (m *UserMembership) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *UserMembership) Reduce(event *models.Event) (err error) { +func (m *UserMembership) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case iam_es_model.IAMAggregate: err = m.processIAM(event) @@ -94,7 +93,7 @@ func (m *UserMembership) Reduce(event *models.Event) (err error) { return err } -func (m *UserMembership) processIAM(event *models.Event) (err error) { +func (m *UserMembership) processIAM(event *es_models.Event) (err error) { member := new(usr_es_model.UserMembershipView) err = member.AppendEvent(event) if err != nil { @@ -125,7 +124,7 @@ func (m *UserMembership) fillIamDisplayName(member *usr_es_model.UserMembershipV member.ResourceOwnerName = member.ResourceOwner } -func (m *UserMembership) processOrg(event *models.Event) (err error) { +func (m *UserMembership) processOrg(event *es_models.Event) (err error) { member := new(usr_es_model.UserMembershipView) err = member.AppendEvent(event) if err != nil { @@ -165,7 +164,7 @@ func (m *UserMembership) fillOrgName(member *usr_es_model.UserMembershipView) (e return nil } -func (m *UserMembership) updateOrgName(event *models.Event) error { +func (m *UserMembership) updateOrgName(event *es_models.Event) error { org, err := m.getOrgByID(context.Background(), event.AggregateID) if err != nil { return err @@ -184,7 +183,7 @@ func (m *UserMembership) updateOrgName(event *models.Event) error { return m.view.BulkPutUserMemberships(memberships, event) } -func (m *UserMembership) processProject(event *models.Event) (err error) { +func (m *UserMembership) processProject(event *es_models.Event) (err error) { member := new(usr_es_model.UserMembershipView) err = member.AppendEvent(event) if err != nil { @@ -237,7 +236,7 @@ func (m *UserMembership) fillProjectDisplayName(member *usr_es_model.UserMembers return nil } -func (m *UserMembership) updateProjectDisplayName(event *models.Event) error { +func (m *UserMembership) updateProjectDisplayName(event *es_models.Event) error { project, err := m.getProjectByID(context.Background(), event.AggregateID) if err != nil { return err @@ -253,7 +252,7 @@ func (m *UserMembership) updateProjectDisplayName(event *models.Event) error { return m.view.BulkPutUserMemberships(memberships, event) } -func (m *UserMembership) processUser(event *models.Event) (err error) { +func (m *UserMembership) processUser(event *es_models.Event) (err error) { switch event.Type { case model.UserRemoved: return m.view.DeleteUserMembershipsByUserID(event.AggregateID, event) @@ -262,7 +261,7 @@ func (m *UserMembership) processUser(event *models.Event) (err error) { } } -func (m *UserMembership) OnError(event *models.Event, err error) error { +func (m *UserMembership) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Ms3fj", "id", event.AggregateID).WithError(err).Warn("something went wrong in user membership handler") return spooler.HandleError(event, err, m.view.GetLatestUserMembershipFailedEvent, m.view.ProcessedUserMembershipFailedEvent, m.view.ProcessedUserMembershipSequence, m.errorCountUntilSkip) } @@ -277,7 +276,7 @@ func (u *UserMembership) getOrgByID(ctx context.Context, orgID string) (*org_mod return nil, err } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } @@ -298,7 +297,7 @@ func (u *UserMembership) getProjectByID(ctx context.Context, projID string) (*pr return nil, err } esProject := &proj_es_model.Project{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: projID, }, } diff --git a/internal/auth/repository/eventsourcing/handler/user_session.go b/internal/auth/repository/eventsourcing/handler/user_session.go index 17c8ec594c..c98bd1b26d 100644 --- a/internal/auth/repository/eventsourcing/handler/user_session.go +++ b/internal/auth/repository/eventsourcing/handler/user_session.go @@ -4,10 +4,10 @@ import ( "github.com/caos/logging" req_model "github.com/caos/zitadel/internal/auth_request/model" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" "github.com/caos/zitadel/internal/user/repository/view" view_model "github.com/caos/zitadel/internal/user/repository/view/model" @@ -19,7 +19,7 @@ const ( type UserSession struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUserSession( diff --git a/internal/auth/repository/eventsourcing/repository.go b/internal/auth/repository/eventsourcing/repository.go index c7abff4dcf..412be24ea5 100644 --- a/internal/auth/repository/eventsourcing/repository.go +++ b/internal/auth/repository/eventsourcing/repository.go @@ -2,6 +2,7 @@ package eventsourcing import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/api/authz" "github.com/caos/zitadel/internal/auth/repository/eventsourcing/eventstore" @@ -9,21 +10,20 @@ import ( auth_view "github.com/caos/zitadel/internal/auth/repository/eventsourcing/view" "github.com/caos/zitadel/internal/auth_request/repository/cache" authz_repo "github.com/caos/zitadel/internal/authz/repository/eventsourcing" + "github.com/caos/zitadel/internal/command" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/config/types" "github.com/caos/zitadel/internal/crypto" - es_int "github.com/caos/zitadel/internal/eventstore" - es_spol "github.com/caos/zitadel/internal/eventstore/spooler" + es_spol "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/id" key_model "github.com/caos/zitadel/internal/key/model" - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/query" ) type Config struct { SearchLimit uint64 Domain string - Eventstore es_int.Config + Eventstore v1.Config AuthRequest cache.Config View types.SQL Spooler spooler.SpoolerConfig @@ -31,7 +31,7 @@ type Config struct { type EsRepository struct { spooler *es_spol.Spooler - Eventstore es_int.Eventstore + Eventstore v1.Eventstore eventstore.UserRepo eventstore.AuthRequestRepo eventstore.TokenRepo @@ -44,7 +44,7 @@ type EsRepository struct { } func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, command *command.CommandSide, authZRepo *authz_repo.EsRepository) (*EsRepository, error) { - es, err := es_int.Start(conf.Eventstore) + es, err := v1.Start(conf.Eventstore) if err != nil { return nil, err } @@ -111,10 +111,12 @@ func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults, co IAMID: systemDefaults.IamID, }, eventstore.TokenRepo{ - View: view, + View: view, }, eventstore.KeyRepository{ View: view, + Commands: command, + Eventstore: esV2, SigningKeyRotationCheck: systemDefaults.KeyConfig.SigningKeyRotationCheck.Duration, SigningKeyGracefulPeriod: systemDefaults.KeyConfig.SigningKeyGracefulPeriod.Duration, KeyAlgorithm: keyAlgorithm, diff --git a/internal/auth/repository/eventsourcing/spooler/lock.go b/internal/auth/repository/eventsourcing/spooler/lock.go index 1ba6656c32..a7b0bb41ad 100644 --- a/internal/auth/repository/eventsourcing/spooler/lock.go +++ b/internal/auth/repository/eventsourcing/spooler/lock.go @@ -4,7 +4,7 @@ import ( "database/sql" "time" - es_locker "github.com/caos/zitadel/internal/eventstore/locker" + es_locker "github.com/caos/zitadel/internal/eventstore/v1/locker" ) const ( diff --git a/internal/auth/repository/eventsourcing/spooler/spooler.go b/internal/auth/repository/eventsourcing/spooler/spooler.go index 4f4967c9f2..e2b842364c 100644 --- a/internal/auth/repository/eventsourcing/spooler/spooler.go +++ b/internal/auth/repository/eventsourcing/spooler/spooler.go @@ -2,12 +2,12 @@ package spooler import ( "database/sql" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/auth/repository/eventsourcing/handler" "github.com/caos/zitadel/internal/auth/repository/eventsourcing/view" sd "github.com/caos/zitadel/internal/config/systemdefaults" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" key_model "github.com/caos/zitadel/internal/key/model" ) @@ -18,7 +18,7 @@ type SpoolerConfig struct { Handlers handler.Configs } -func StartSpooler(c SpoolerConfig, es eventstore.Eventstore, view *view.View, client *sql.DB, systemDefaults sd.SystemDefaults, keyChan chan<- *key_model.KeyView) *spooler.Spooler { +func StartSpooler(c SpoolerConfig, es v1.Eventstore, view *view.View, client *sql.DB, systemDefaults sd.SystemDefaults, keyChan chan<- *key_model.KeyView) *spooler.Spooler { spoolerConfig := spooler.Config{ Eventstore: es, Locker: &locker{dbClient: client}, diff --git a/internal/auth/repository/eventsourcing/view/application.go b/internal/auth/repository/eventsourcing/view/application.go index e0e6315dfb..aaf1229def 100644 --- a/internal/auth/repository/eventsourcing/view/application.go +++ b/internal/auth/repository/eventsourcing/view/application.go @@ -4,7 +4,7 @@ import ( "context" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" global_model "github.com/caos/zitadel/internal/model" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" diff --git a/internal/auth/repository/eventsourcing/view/authn_keys.go b/internal/auth/repository/eventsourcing/view/authn_keys.go index 4873c64786..71cf505445 100644 --- a/internal/auth/repository/eventsourcing/view/authn_keys.go +++ b/internal/auth/repository/eventsourcing/view/authn_keys.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" key_model "github.com/caos/zitadel/internal/key/model" "github.com/caos/zitadel/internal/key/repository/view" "github.com/caos/zitadel/internal/key/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/external_idps.go b/internal/auth/repository/eventsourcing/view/external_idps.go index 05734c7d88..2405ed676f 100644 --- a/internal/auth/repository/eventsourcing/view/external_idps.go +++ b/internal/auth/repository/eventsourcing/view/external_idps.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/idp_configs.go b/internal/auth/repository/eventsourcing/view/idp_configs.go index 6a7b8a3910..5e0d604c6f 100644 --- a/internal/auth/repository/eventsourcing/view/idp_configs.go +++ b/internal/auth/repository/eventsourcing/view/idp_configs.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/view" iam_es_model "github.com/caos/zitadel/internal/iam/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/idp_providers.go b/internal/auth/repository/eventsourcing/view/idp_providers.go index 2b17531533..1b720ccdc2 100644 --- a/internal/auth/repository/eventsourcing/view/idp_providers.go +++ b/internal/auth/repository/eventsourcing/view/idp_providers.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/key.go b/internal/auth/repository/eventsourcing/view/key.go index e9cd8adcd8..111db368fd 100644 --- a/internal/auth/repository/eventsourcing/view/key.go +++ b/internal/auth/repository/eventsourcing/view/key.go @@ -4,7 +4,7 @@ import ( "time" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" key_model "github.com/caos/zitadel/internal/key/model" "github.com/caos/zitadel/internal/key/repository/view" "github.com/caos/zitadel/internal/key/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/login_policies.go b/internal/auth/repository/eventsourcing/view/login_policies.go index a0533b99d1..bc9caf903e 100644 --- a/internal/auth/repository/eventsourcing/view/login_policies.go +++ b/internal/auth/repository/eventsourcing/view/login_policies.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/auth/repository/eventsourcing/view/org.go b/internal/auth/repository/eventsourcing/view/org.go index e8407deb72..3cf4e7f17a 100644 --- a/internal/auth/repository/eventsourcing/view/org.go +++ b/internal/auth/repository/eventsourcing/view/org.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/org/model" org_view "github.com/caos/zitadel/internal/org/repository/view" org_model "github.com/caos/zitadel/internal/org/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/org_iam_policy.go b/internal/auth/repository/eventsourcing/view/org_iam_policy.go index 3dba05807d..ec089700a6 100644 --- a/internal/auth/repository/eventsourcing/view/org_iam_policy.go +++ b/internal/auth/repository/eventsourcing/view/org_iam_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/auth/repository/eventsourcing/view/password_complexity_policy.go b/internal/auth/repository/eventsourcing/view/password_complexity_policy.go index 9c054fd8e5..481ef1ac12 100644 --- a/internal/auth/repository/eventsourcing/view/password_complexity_policy.go +++ b/internal/auth/repository/eventsourcing/view/password_complexity_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/auth/repository/eventsourcing/view/project_role.go b/internal/auth/repository/eventsourcing/view/project_role.go index a27672319c..9c37399373 100644 --- a/internal/auth/repository/eventsourcing/view/project_role.go +++ b/internal/auth/repository/eventsourcing/view/project_role.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/sequence.go b/internal/auth/repository/eventsourcing/view/sequence.go index cf75ab7606..15b7c15d62 100644 --- a/internal/auth/repository/eventsourcing/view/sequence.go +++ b/internal/auth/repository/eventsourcing/view/sequence.go @@ -3,7 +3,7 @@ package view import ( "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/view/repository" ) diff --git a/internal/auth/repository/eventsourcing/view/token.go b/internal/auth/repository/eventsourcing/view/token.go index 032953d529..d6a547f8e3 100644 --- a/internal/auth/repository/eventsourcing/view/token.go +++ b/internal/auth/repository/eventsourcing/view/token.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_view "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/auth/repository/eventsourcing/view/user.go b/internal/auth/repository/eventsourcing/view/user.go index a93a92c982..9b6ab25bd4 100644 --- a/internal/auth/repository/eventsourcing/view/user.go +++ b/internal/auth/repository/eventsourcing/view/user.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/user_grant.go b/internal/auth/repository/eventsourcing/view/user_grant.go index 4d713fd073..b34a36f8d8 100644 --- a/internal/auth/repository/eventsourcing/view/user_grant.go +++ b/internal/auth/repository/eventsourcing/view/user_grant.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" grant_model "github.com/caos/zitadel/internal/usergrant/model" "github.com/caos/zitadel/internal/usergrant/repository/view" "github.com/caos/zitadel/internal/usergrant/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/user_membership.go b/internal/auth/repository/eventsourcing/view/user_membership.go index 1574a668ef..8508bc2086 100644 --- a/internal/auth/repository/eventsourcing/view/user_membership.go +++ b/internal/auth/repository/eventsourcing/view/user_membership.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/auth/repository/eventsourcing/view/user_session.go b/internal/auth/repository/eventsourcing/view/user_session.go index 01ec5360df..988f79dca7 100644 --- a/internal/auth/repository/eventsourcing/view/user_session.go +++ b/internal/auth/repository/eventsourcing/view/user_session.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/auth_request/model/next_step.go b/internal/auth_request/model/next_step.go index 3d4a5e01ec..9595f82732 100644 --- a/internal/auth_request/model/next_step.go +++ b/internal/auth_request/model/next_step.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) type NextStep interface { diff --git a/internal/auth_request/repository/cache/cache.go b/internal/auth_request/repository/cache/cache.go index 7bfacaaf5d..41c5a65b49 100644 --- a/internal/auth_request/repository/cache/cache.go +++ b/internal/auth_request/repository/cache/cache.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" "fmt" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/config/types" caos_errs "github.com/caos/zitadel/internal/errors" diff --git a/internal/auth_request/repository/mock/repository.mock.go b/internal/auth_request/repository/mock/repository.mock.go index b4296ae16b..54669d9f60 100644 --- a/internal/auth_request/repository/mock/repository.mock.go +++ b/internal/auth_request/repository/mock/repository.mock.go @@ -6,7 +6,7 @@ package mock import ( context "context" - domain "github.com/caos/zitadel/internal/v2/domain" + domain "github.com/caos/zitadel/internal/domain" gomock "github.com/golang/mock/gomock" reflect "reflect" ) diff --git a/internal/auth_request/repository/repository.go b/internal/auth_request/repository/repository.go index ab9ca86f47..32c3cf86e6 100644 --- a/internal/auth_request/repository/repository.go +++ b/internal/auth_request/repository/repository.go @@ -2,7 +2,7 @@ package repository import ( "context" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) type AuthRequestCache interface { diff --git a/internal/authz/repository/eventsourcing/eventstore/iam.go b/internal/authz/repository/eventsourcing/eventstore/iam.go index 505b8e891a..82b4c8a23c 100644 --- a/internal/authz/repository/eventsourcing/eventstore/iam.go +++ b/internal/authz/repository/eventsourcing/eventstore/iam.go @@ -2,7 +2,7 @@ package eventstore import ( "context" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/query" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/authz/repository/eventsourcing/eventstore/token_verifier.go b/internal/authz/repository/eventsourcing/eventstore/token_verifier.go index f9bc9b7304..fabfdd27a4 100644 --- a/internal/authz/repository/eventsourcing/eventstore/token_verifier.go +++ b/internal/authz/repository/eventsourcing/eventstore/token_verifier.go @@ -2,17 +2,17 @@ package eventstore import ( "context" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" - "github.com/caos/zitadel/internal/v2/domain" "k8s.io/apimachinery/pkg/api/errors" "strings" "time" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_view "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/logging" @@ -28,7 +28,7 @@ import ( type TokenVerifierRepo struct { TokenVerificationKey [32]byte IAMID string - Eventstore eventstore.Eventstore + Eventstore v1.Eventstore View *view.View } diff --git a/internal/authz/repository/eventsourcing/eventstore/user_grant.go b/internal/authz/repository/eventsourcing/eventstore/user_grant.go index 0f0e579c7c..81c8208fec 100644 --- a/internal/authz/repository/eventsourcing/eventstore/user_grant.go +++ b/internal/authz/repository/eventsourcing/eventstore/user_grant.go @@ -2,9 +2,9 @@ package eventstore import ( "context" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/eventstore/v1" + "github.com/caos/zitadel/internal/eventstore/v1/models" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" @@ -12,12 +12,12 @@ import ( "github.com/caos/zitadel/internal/api/authz" "github.com/caos/zitadel/internal/authz/repository/eventsourcing/view" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" global_model "github.com/caos/zitadel/internal/model" user_model "github.com/caos/zitadel/internal/user/model" user_view_model "github.com/caos/zitadel/internal/user/repository/view/model" grant_model "github.com/caos/zitadel/internal/usergrant/model" - "github.com/caos/zitadel/internal/v2/domain" ) type UserGrantRepo struct { @@ -25,7 +25,7 @@ type UserGrantRepo struct { IamID string IamProjectID string Auth authz.Config - Eventstore eventstore.Eventstore + Eventstore v1.Eventstore } func (repo *UserGrantRepo) Health() error { diff --git a/internal/authz/repository/eventsourcing/handler/application.go b/internal/authz/repository/eventsourcing/handler/application.go index 45203b1259..12f8b92326 100644 --- a/internal/authz/repository/eventsourcing/handler/application.go +++ b/internal/authz/repository/eventsourcing/handler/application.go @@ -2,11 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "github.com/caos/zitadel/internal/project/repository/view" view_model "github.com/caos/zitadel/internal/project/repository/view/model" @@ -18,7 +18,7 @@ const ( type Application struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newApplication(handler handler) *Application { diff --git a/internal/authz/repository/eventsourcing/handler/handler.go b/internal/authz/repository/eventsourcing/handler/handler.go index f27207fd93..f3a32c9cba 100644 --- a/internal/authz/repository/eventsourcing/handler/handler.go +++ b/internal/authz/repository/eventsourcing/handler/handler.go @@ -1,13 +1,13 @@ package handler import ( + "github.com/caos/zitadel/internal/eventstore/v1" "time" "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/eventstore" - "github.com/caos/zitadel/internal/eventstore/query" + "github.com/caos/zitadel/internal/eventstore/v1/query" ) type Configs map[string]*Config @@ -22,14 +22,14 @@ type handler struct { cycleDuration time.Duration errorCountUntilSkip uint64 - es eventstore.Eventstore + es v1.Eventstore } -func (h *handler) Eventstore() eventstore.Eventstore { +func (h *handler) Eventstore() v1.Eventstore { return h.es } -func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es eventstore.Eventstore, systemDefaults sd.SystemDefaults) []query.Handler { +func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es v1.Eventstore, systemDefaults sd.SystemDefaults) []query.Handler { return []query.Handler{ newUserGrant( handler{view, bulkLimit, configs.cycleDuration("UserGrants"), errorCount, es}, diff --git a/internal/authz/repository/eventsourcing/handler/org.go b/internal/authz/repository/eventsourcing/handler/org.go index 08321e37af..64077090b5 100644 --- a/internal/authz/repository/eventsourcing/handler/org.go +++ b/internal/authz/repository/eventsourcing/handler/org.go @@ -2,12 +2,12 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/repository/view/model" ) @@ -18,7 +18,7 @@ const ( type Org struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrg(handler handler) *Org { diff --git a/internal/authz/repository/eventsourcing/handler/user_grant.go b/internal/authz/repository/eventsourcing/handler/user_grant.go index 4911a1f76b..0bff1bc1fb 100644 --- a/internal/authz/repository/eventsourcing/handler/user_grant.go +++ b/internal/authz/repository/eventsourcing/handler/user_grant.go @@ -2,25 +2,24 @@ package handler import ( "context" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/eventstore/v1" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_model "github.com/caos/zitadel/internal/iam/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" "strings" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" proj_es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" view_model "github.com/caos/zitadel/internal/usergrant/repository/view/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -31,7 +30,7 @@ type UserGrant struct { handler iamID string iamProjectID string - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUserGrant( @@ -73,7 +72,7 @@ func (u *UserGrant) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (u *UserGrant) EventQuery() (*models.SearchQuery, error) { +func (u *UserGrant) EventQuery() (*es_models.SearchQuery, error) { if u.iamProjectID == "" { err := u.setIamProjectID() if err != nil { @@ -89,7 +88,7 @@ func (u *UserGrant) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (u *UserGrant) Reduce(event *models.Event) (err error) { +func (u *UserGrant) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case proj_es_model.ProjectAggregate: err = u.processProject(event) @@ -101,7 +100,7 @@ func (u *UserGrant) Reduce(event *models.Event) (err error) { return err } -func (u *UserGrant) processProject(event *models.Event) (err error) { +func (u *UserGrant) processProject(event *es_models.Event) (err error) { switch event.Type { case proj_es_model.ProjectMemberAdded, proj_es_model.ProjectMemberChanged, proj_es_model.ProjectMemberRemoved: member := new(proj_es_model.ProjectMember) @@ -116,7 +115,7 @@ func (u *UserGrant) processProject(event *models.Event) (err error) { } } -func (u *UserGrant) processOrg(event *models.Event) (err error) { +func (u *UserGrant) processOrg(event *es_models.Event) (err error) { switch event.Type { case org_es_model.OrgMemberAdded, org_es_model.OrgMemberChanged, org_es_model.OrgMemberRemoved: member := new(org_es_model.OrgMember) @@ -127,7 +126,7 @@ func (u *UserGrant) processOrg(event *models.Event) (err error) { } } -func (u *UserGrant) processIAMMember(event *models.Event, rolePrefix string, suffix bool) error { +func (u *UserGrant) processIAMMember(event *es_models.Event, rolePrefix string, suffix bool) error { member := new(iam_es_model.IAMMember) switch event.Type { @@ -174,7 +173,7 @@ func (u *UserGrant) processIAMMember(event *models.Event, rolePrefix string, suf } } -func (u *UserGrant) processMember(event *models.Event, rolePrefix, roleSuffix string, userID string, roleKeys []string) error { +func (u *UserGrant) processMember(event *es_models.Event, rolePrefix, roleSuffix string, userID string, roleKeys []string) error { switch event.Type { case org_es_model.OrgMemberAdded, proj_es_model.ProjectMemberAdded, proj_es_model.ProjectGrantMemberAdded, org_es_model.OrgMemberChanged, proj_es_model.ProjectMemberChanged, proj_es_model.ProjectGrantMemberChanged: @@ -268,7 +267,7 @@ func (u *UserGrant) setIamProjectID() error { return nil } -func (u *UserGrant) OnError(event *models.Event, err error) error { +func (u *UserGrant) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-VcVoJ", "id", event.AggregateID).WithError(err).Warn("something went wrong in user grant handler") return spooler.HandleError(event, err, u.view.GetLatestUserGrantFailedEvent, u.view.ProcessedUserGrantFailedEvent, u.view.ProcessedUserGrantSequence, u.errorCountUntilSkip) } @@ -283,7 +282,7 @@ func (u *UserGrant) getIAMByID(ctx context.Context) (*iam_model.IAM, error) { return nil, err } iam := &iam_es_model.IAM{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: domain.IAMID, }, } diff --git a/internal/authz/repository/eventsourcing/handler/user_membership.go b/internal/authz/repository/eventsourcing/handler/user_membership.go index 4081d58e57..62e459688d 100644 --- a/internal/authz/repository/eventsourcing/handler/user_membership.go +++ b/internal/authz/repository/eventsourcing/handler/user_membership.go @@ -2,16 +2,15 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -30,7 +29,7 @@ const ( type UserMembership struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUserMembership( @@ -70,7 +69,7 @@ func (m *UserMembership) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *UserMembership) EventQuery() (*models.SearchQuery, error) { +func (m *UserMembership) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestUserMembershipSequence() if err != nil { return nil, err @@ -80,7 +79,7 @@ func (m *UserMembership) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *UserMembership) Reduce(event *models.Event) (err error) { +func (m *UserMembership) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case iam_es_model.IAMAggregate: err = m.processIAM(event) @@ -94,7 +93,7 @@ func (m *UserMembership) Reduce(event *models.Event) (err error) { return err } -func (m *UserMembership) processIAM(event *models.Event) (err error) { +func (m *UserMembership) processIAM(event *es_models.Event) (err error) { member := new(usr_es_model.UserMembershipView) err = member.AppendEvent(event) if err != nil { @@ -125,7 +124,7 @@ func (m *UserMembership) fillIamDisplayName(member *usr_es_model.UserMembershipV member.ResourceOwnerName = member.ResourceOwner } -func (m *UserMembership) processOrg(event *models.Event) (err error) { +func (m *UserMembership) processOrg(event *es_models.Event) (err error) { member := new(usr_es_model.UserMembershipView) err = member.AppendEvent(event) if err != nil { @@ -165,7 +164,7 @@ func (m *UserMembership) fillOrgName(member *usr_es_model.UserMembershipView) (e return nil } -func (m *UserMembership) updateOrgName(event *models.Event) error { +func (m *UserMembership) updateOrgName(event *es_models.Event) error { org, err := m.getOrgByID(context.Background(), event.AggregateID) if err != nil { return err @@ -184,7 +183,7 @@ func (m *UserMembership) updateOrgName(event *models.Event) error { return m.view.BulkPutUserMemberships(memberships, event) } -func (m *UserMembership) processProject(event *models.Event) (err error) { +func (m *UserMembership) processProject(event *es_models.Event) (err error) { member := new(usr_es_model.UserMembershipView) err = member.AppendEvent(event) if err != nil { @@ -237,7 +236,7 @@ func (m *UserMembership) fillProjectDisplayName(member *usr_es_model.UserMembers return nil } -func (m *UserMembership) updateProjectDisplayName(event *models.Event) error { +func (m *UserMembership) updateProjectDisplayName(event *es_models.Event) error { project, err := m.getProjectByID(context.Background(), event.AggregateID) if err != nil { return err @@ -253,7 +252,7 @@ func (m *UserMembership) updateProjectDisplayName(event *models.Event) error { return m.view.BulkPutUserMemberships(memberships, event) } -func (m *UserMembership) processUser(event *models.Event) (err error) { +func (m *UserMembership) processUser(event *es_models.Event) (err error) { switch event.Type { case model.UserRemoved: return m.view.DeleteUserMembershipsByUserID(event.AggregateID, event) @@ -262,7 +261,7 @@ func (m *UserMembership) processUser(event *models.Event) (err error) { } } -func (m *UserMembership) OnError(event *models.Event, err error) error { +func (m *UserMembership) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Ms3fj", "id", event.AggregateID).WithError(err).Warn("something went wrong in user membership handler") return spooler.HandleError(event, err, m.view.GetLatestUserMembershipFailedEvent, m.view.ProcessedUserMembershipFailedEvent, m.view.ProcessedUserMembershipSequence, m.errorCountUntilSkip) } @@ -295,7 +294,7 @@ func (u *UserMembership) getProjectByID(ctx context.Context, projID string) (*pr return nil, err } esProject := &proj_es_model.Project{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: projID, }, } diff --git a/internal/authz/repository/eventsourcing/repository.go b/internal/authz/repository/eventsourcing/repository.go index f569d9ff8e..91c232d61d 100644 --- a/internal/authz/repository/eventsourcing/repository.go +++ b/internal/authz/repository/eventsourcing/repository.go @@ -2,8 +2,9 @@ package eventsourcing import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/query" "github.com/caos/zitadel/internal/api/authz" "github.com/caos/zitadel/internal/auth_request/repository/cache" @@ -12,14 +13,13 @@ import ( 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" - es_int "github.com/caos/zitadel/internal/eventstore" - es_spol "github.com/caos/zitadel/internal/eventstore/spooler" + es_spol "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/id" ) type Config struct { Domain string - Eventstore es_int.Config + Eventstore v1.Config AuthRequest cache.Config View types.SQL Spooler spooler.SpoolerConfig @@ -33,7 +33,7 @@ type EsRepository struct { } func Start(conf Config, authZ authz.Config, systemDefaults sd.SystemDefaults) (*EsRepository, error) { - es, err := es_int.Start(conf.Eventstore) + es, err := v1.Start(conf.Eventstore) if err != nil { return nil, err } diff --git a/internal/authz/repository/eventsourcing/spooler/lock.go b/internal/authz/repository/eventsourcing/spooler/lock.go index 6100f470d3..1c58c9392f 100644 --- a/internal/authz/repository/eventsourcing/spooler/lock.go +++ b/internal/authz/repository/eventsourcing/spooler/lock.go @@ -2,7 +2,7 @@ package spooler import ( "database/sql" - es_locker "github.com/caos/zitadel/internal/eventstore/locker" + es_locker "github.com/caos/zitadel/internal/eventstore/v1/locker" "time" ) diff --git a/internal/authz/repository/eventsourcing/spooler/spooler.go b/internal/authz/repository/eventsourcing/spooler/spooler.go index e8f8322398..332e222f8f 100644 --- a/internal/authz/repository/eventsourcing/spooler/spooler.go +++ b/internal/authz/repository/eventsourcing/spooler/spooler.go @@ -2,14 +2,14 @@ package spooler import ( "database/sql" + "github.com/caos/zitadel/internal/eventstore/v1" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/authz/repository/eventsourcing/handler" "github.com/caos/zitadel/internal/authz/repository/eventsourcing/view" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" ) type SpoolerConfig struct { @@ -19,7 +19,7 @@ type SpoolerConfig struct { Handlers handler.Configs } -func StartSpooler(c SpoolerConfig, es eventstore.Eventstore, view *view.View, sql *sql.DB, systemDefaults sd.SystemDefaults) *spooler.Spooler { +func StartSpooler(c SpoolerConfig, es v1.Eventstore, view *view.View, sql *sql.DB, systemDefaults sd.SystemDefaults) *spooler.Spooler { spoolerConfig := spooler.Config{ Eventstore: es, Locker: &locker{dbClient: sql}, diff --git a/internal/authz/repository/eventsourcing/view/application.go b/internal/authz/repository/eventsourcing/view/application.go index 9757a663fb..1b1b66c699 100644 --- a/internal/authz/repository/eventsourcing/view/application.go +++ b/internal/authz/repository/eventsourcing/view/application.go @@ -4,7 +4,7 @@ import ( "context" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/authz/repository/eventsourcing/view/org.go b/internal/authz/repository/eventsourcing/view/org.go index aa99489968..0b395101d2 100644 --- a/internal/authz/repository/eventsourcing/view/org.go +++ b/internal/authz/repository/eventsourcing/view/org.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/org/model" org_view "github.com/caos/zitadel/internal/org/repository/view" org_model "github.com/caos/zitadel/internal/org/repository/view/model" diff --git a/internal/authz/repository/eventsourcing/view/sequence.go b/internal/authz/repository/eventsourcing/view/sequence.go index 056c2a0399..5ac2f37443 100644 --- a/internal/authz/repository/eventsourcing/view/sequence.go +++ b/internal/authz/repository/eventsourcing/view/sequence.go @@ -3,7 +3,7 @@ package view import ( "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/view/repository" ) diff --git a/internal/authz/repository/eventsourcing/view/token.go b/internal/authz/repository/eventsourcing/view/token.go index 8cd63fd8d1..ee43edfad2 100644 --- a/internal/authz/repository/eventsourcing/view/token.go +++ b/internal/authz/repository/eventsourcing/view/token.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_view "github.com/caos/zitadel/internal/user/repository/view" usr_view_model "github.com/caos/zitadel/internal/user/repository/view/model" "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/authz/repository/eventsourcing/view/user_grant.go b/internal/authz/repository/eventsourcing/view/user_grant.go index 210d08dcb4..6886dcf8e8 100644 --- a/internal/authz/repository/eventsourcing/view/user_grant.go +++ b/internal/authz/repository/eventsourcing/view/user_grant.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" grant_model "github.com/caos/zitadel/internal/usergrant/model" "github.com/caos/zitadel/internal/usergrant/repository/view" "github.com/caos/zitadel/internal/usergrant/repository/view/model" diff --git a/internal/authz/repository/eventsourcing/view/user_membership.go b/internal/authz/repository/eventsourcing/view/user_membership.go index add7b3aa81..e570fb51ed 100644 --- a/internal/authz/repository/eventsourcing/view/user_membership.go +++ b/internal/authz/repository/eventsourcing/view/user_membership.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/cache/bigcache/bigcache_test.go b/internal/cache/bigcache/bigcache_test.go index 9500ca92ff..f024d52ae2 100644 --- a/internal/cache/bigcache/bigcache_test.go +++ b/internal/cache/bigcache/bigcache_test.go @@ -3,7 +3,7 @@ package bigcache import ( a_cache "github.com/allegro/bigcache" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "reflect" "testing" ) diff --git a/internal/cache/fastcache/fastcache_test.go b/internal/cache/fastcache/fastcache_test.go index 2189e5440c..2e783a6234 100644 --- a/internal/cache/fastcache/fastcache_test.go +++ b/internal/cache/fastcache/fastcache_test.go @@ -3,7 +3,7 @@ package fastcache import ( "github.com/VictoriaMetrics/fastcache" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "reflect" "testing" ) diff --git a/internal/v2/command/auth_checks.go b/internal/command/auth_checks.go similarity index 100% rename from internal/v2/command/auth_checks.go rename to internal/command/auth_checks.go diff --git a/internal/v2/command/command.go b/internal/command/command.go similarity index 92% rename from internal/v2/command/command.go rename to internal/command/command.go index 2e1f6cbd33..f7dd5a0cdc 100644 --- a/internal/v2/command/command.go +++ b/internal/command/command.go @@ -2,21 +2,21 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/api/http" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" "github.com/caos/zitadel/internal/id" global_model "github.com/caos/zitadel/internal/model" + iam_repo "github.com/caos/zitadel/internal/repository/iam" + keypair "github.com/caos/zitadel/internal/repository/keypair" + "github.com/caos/zitadel/internal/repository/org" + proj_repo "github.com/caos/zitadel/internal/repository/project" + usr_repo "github.com/caos/zitadel/internal/repository/user" + usr_grant_repo "github.com/caos/zitadel/internal/repository/usergrant" "github.com/caos/zitadel/internal/telemetry/tracing" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" - keypair "github.com/caos/zitadel/internal/v2/repository/keypair" - "github.com/caos/zitadel/internal/v2/repository/org" - proj_repo "github.com/caos/zitadel/internal/v2/repository/project" - usr_repo "github.com/caos/zitadel/internal/v2/repository/user" - usr_grant_repo "github.com/caos/zitadel/internal/v2/repository/usergrant" webauthn_helper "github.com/caos/zitadel/internal/webauthn" ) diff --git a/internal/v2/command/iam.go b/internal/command/iam.go similarity index 89% rename from internal/v2/command/iam.go rename to internal/command/iam.go index 723907e9cd..54c51bc1c0 100644 --- a/internal/v2/command/iam.go +++ b/internal/command/iam.go @@ -2,11 +2,10 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) //TODO: private diff --git a/internal/v2/command/iam_converter.go b/internal/command/iam_converter.go similarity index 96% rename from internal/v2/command/iam_converter.go rename to internal/command/iam_converter.go index d2812db67a..a90904cc6e 100644 --- a/internal/v2/command/iam_converter.go +++ b/internal/command/iam_converter.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) func writeModelToObjectRoot(writeModel eventstore.WriteModel) models.ObjectRoot { diff --git a/internal/v2/command/iam_idp_config.go b/internal/command/iam_idp_config.go similarity index 97% rename from internal/v2/command/iam_idp_config.go rename to internal/command/iam_idp_config.go index 4b37044ff0..6c6b5075c5 100644 --- a/internal/v2/command/iam_idp_config.go +++ b/internal/command/iam_idp_config.go @@ -2,14 +2,14 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" + iam_repo "github.com/caos/zitadel/internal/repository/iam" ) func (r *CommandSide) AddDefaultIDPConfig(ctx context.Context, config *domain.IDPConfig) (*domain.IDPConfig, error) { diff --git a/internal/v2/command/iam_idp_config_model.go b/internal/command/iam_idp_config_model.go similarity index 93% rename from internal/v2/command/iam_idp_config_model.go rename to internal/command/iam_idp_config_model.go index 02c00f1dae..f3aef0604b 100644 --- a/internal/v2/command/iam_idp_config_model.go +++ b/internal/command/iam_idp_config_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/idpconfig" ) type IAMIDPConfigWriteModel struct { diff --git a/internal/v2/command/iam_idp_oidc_config.go b/internal/command/iam_idp_oidc_config.go similarity index 96% rename from internal/v2/command/iam_idp_oidc_config.go rename to internal/command/iam_idp_oidc_config.go index ea86da402e..64852d2195 100644 --- a/internal/v2/command/iam_idp_oidc_config.go +++ b/internal/command/iam_idp_oidc_config.go @@ -2,8 +2,8 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" ) func (r *CommandSide) ChangeDefaultIDPOIDCConfig(ctx context.Context, config *domain.OIDCIDPConfig) (*domain.OIDCIDPConfig, error) { diff --git a/internal/v2/command/iam_idp_oidc_config_model.go b/internal/command/iam_idp_oidc_config_model.go similarity index 94% rename from internal/v2/command/iam_idp_oidc_config_model.go rename to internal/command/iam_idp_oidc_config_model.go index 77ade5d377..5f2e2f1454 100644 --- a/internal/v2/command/iam_idp_oidc_config_model.go +++ b/internal/command/iam_idp_oidc_config_model.go @@ -2,13 +2,13 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "reflect" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/idpconfig" ) type IAMIDPOIDCConfigWriteModel struct { diff --git a/internal/v2/command/iam_member.go b/internal/command/iam_member.go similarity index 95% rename from internal/v2/command/iam_member.go rename to internal/command/iam_member.go index 968301d2cb..3d902d361a 100644 --- a/internal/v2/command/iam_member.go +++ b/internal/command/iam_member.go @@ -2,14 +2,14 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" "reflect" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) AddIAMMember(ctx context.Context, member *domain.Member) (*domain.Member, error) { diff --git a/internal/v2/command/iam_member_model.go b/internal/command/iam_member_model.go similarity index 90% rename from internal/v2/command/iam_member_model.go rename to internal/command/iam_member_model.go index ffc7918efd..b7b41dff7a 100644 --- a/internal/v2/command/iam_member_model.go +++ b/internal/command/iam_member_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) type IAMMemberWriteModel struct { diff --git a/internal/v2/command/iam_model.go b/internal/command/iam_model.go similarity index 89% rename from internal/v2/command/iam_model.go rename to internal/command/iam_model.go index 8450a98e8e..8cac5f6235 100644 --- a/internal/v2/command/iam_model.go +++ b/internal/command/iam_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) type IAMWriteModel struct { diff --git a/internal/v2/command/iam_policy_label.go b/internal/command/iam_policy_label.go similarity index 94% rename from internal/v2/command/iam_policy_label.go rename to internal/command/iam_policy_label.go index 03f8390961..9f17980188 100644 --- a/internal/v2/command/iam_policy_label.go +++ b/internal/command/iam_policy_label.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) AddDefaultLabelPolicy(ctx context.Context, policy *domain.LabelPolicy) (*domain.LabelPolicy, error) { diff --git a/internal/v2/command/iam_policy_label_model.go b/internal/command/iam_policy_label_model.go similarity index 89% rename from internal/v2/command/iam_policy_label_model.go rename to internal/command/iam_policy_label_model.go index 1aa3e9b9e3..1808b555d9 100644 --- a/internal/v2/command/iam_policy_label_model.go +++ b/internal/command/iam_policy_label_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMLabelPolicyWriteModel struct { diff --git a/internal/v2/command/iam_policy_login.go b/internal/command/iam_policy_login.go similarity index 98% rename from internal/v2/command/iam_policy_login.go rename to internal/command/iam_policy_login.go index 6c66fa28a3..c77d0e8d31 100644 --- a/internal/v2/command/iam_policy_login.go +++ b/internal/command/iam_policy_login.go @@ -3,12 +3,11 @@ package command import ( "context" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore/v2" - + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) getDefaultLoginPolicy(ctx context.Context) (*domain.LoginPolicy, error) { diff --git a/internal/v2/command/iam_policy_login_factors_model.go b/internal/command/iam_policy_login_factors_model.go similarity index 93% rename from internal/v2/command/iam_policy_login_factors_model.go rename to internal/command/iam_policy_login_factors_model.go index 7bf9104633..b09d880da9 100644 --- a/internal/v2/command/iam_policy_login_factors_model.go +++ b/internal/command/iam_policy_login_factors_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) type IAMSecondFactorWriteModel struct { diff --git a/internal/v2/command/iam_policy_login_identity_provider_model.go b/internal/command/iam_policy_login_identity_provider_model.go similarity index 89% rename from internal/v2/command/iam_policy_login_identity_provider_model.go rename to internal/command/iam_policy_login_identity_provider_model.go index 7f0cd896b5..89332c7b85 100644 --- a/internal/v2/command/iam_policy_login_identity_provider_model.go +++ b/internal/command/iam_policy_login_identity_provider_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) type IAMIdentityProviderWriteModel struct { diff --git a/internal/v2/command/iam_policy_login_model.go b/internal/command/iam_policy_login_model.go similarity index 92% rename from internal/v2/command/iam_policy_login_model.go rename to internal/command/iam_policy_login_model.go index ef2b21b93a..621f0e5e05 100644 --- a/internal/v2/command/iam_policy_login_model.go +++ b/internal/command/iam_policy_login_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMLoginPolicyWriteModel struct { diff --git a/internal/v2/command/iam_policy_mail_template.go b/internal/command/iam_policy_mail_template.go similarity index 94% rename from internal/v2/command/iam_policy_mail_template.go rename to internal/command/iam_policy_mail_template.go index 48c2b341ae..b22e8ac0df 100644 --- a/internal/v2/command/iam_policy_mail_template.go +++ b/internal/command/iam_policy_mail_template.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) AddDefaultMailTemplate(ctx context.Context, policy *domain.MailTemplate) (*domain.MailTemplate, error) { diff --git a/internal/v2/command/iam_policy_mail_template_model.go b/internal/command/iam_policy_mail_template_model.go similarity index 89% rename from internal/v2/command/iam_policy_mail_template_model.go rename to internal/command/iam_policy_mail_template_model.go index 2970b1170c..d35a09449c 100644 --- a/internal/v2/command/iam_policy_mail_template_model.go +++ b/internal/command/iam_policy_mail_template_model.go @@ -2,12 +2,12 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "reflect" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMMailTemplateWriteModel struct { diff --git a/internal/v2/command/iam_policy_mail_text.go b/internal/command/iam_policy_mail_text.go similarity index 95% rename from internal/v2/command/iam_policy_mail_text.go rename to internal/command/iam_policy_mail_text.go index dbf8dd75d4..2ca461854f 100644 --- a/internal/v2/command/iam_policy_mail_text.go +++ b/internal/command/iam_policy_mail_text.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) AddDefaultMailText(ctx context.Context, policy *domain.MailText) (*domain.MailText, error) { diff --git a/internal/v2/command/iam_policy_mail_text_model.go b/internal/command/iam_policy_mail_text_model.go similarity index 91% rename from internal/v2/command/iam_policy_mail_text_model.go rename to internal/command/iam_policy_mail_text_model.go index 0c1b8f598b..6f18224517 100644 --- a/internal/v2/command/iam_policy_mail_text_model.go +++ b/internal/command/iam_policy_mail_text_model.go @@ -2,10 +2,10 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMMailTextWriteModel struct { diff --git a/internal/v2/command/iam_policy_org_iam.go b/internal/command/iam_policy_org_iam.go similarity index 94% rename from internal/v2/command/iam_policy_org_iam.go rename to internal/command/iam_policy_org_iam.go index b197b51253..e96647e976 100644 --- a/internal/v2/command/iam_policy_org_iam.go +++ b/internal/command/iam_policy_org_iam.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) AddDefaultOrgIAMPolicy(ctx context.Context, policy *domain.OrgIAMPolicy) (*domain.OrgIAMPolicy, error) { diff --git a/internal/v2/command/iam_policy_org_iam_model.go b/internal/command/iam_policy_org_iam_model.go similarity index 89% rename from internal/v2/command/iam_policy_org_iam_model.go rename to internal/command/iam_policy_org_iam_model.go index 84e9f13642..ba474742a6 100644 --- a/internal/v2/command/iam_policy_org_iam_model.go +++ b/internal/command/iam_policy_org_iam_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMOrgIAMPolicyWriteModel struct { diff --git a/internal/v2/command/iam_policy_password_age.go b/internal/command/iam_policy_password_age.go similarity index 94% rename from internal/v2/command/iam_policy_password_age.go rename to internal/command/iam_policy_password_age.go index 6d8f84e0eb..5e0dc65c71 100644 --- a/internal/v2/command/iam_policy_password_age.go +++ b/internal/command/iam_policy_password_age.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) AddDefaultPasswordAgePolicy(ctx context.Context, policy *domain.PasswordAgePolicy) (*domain.PasswordAgePolicy, error) { diff --git a/internal/v2/command/iam_policy_password_age_model.go b/internal/command/iam_policy_password_age_model.go similarity index 90% rename from internal/v2/command/iam_policy_password_age_model.go rename to internal/command/iam_policy_password_age_model.go index 588f328c58..125d728248 100644 --- a/internal/v2/command/iam_policy_password_age_model.go +++ b/internal/command/iam_policy_password_age_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMPasswordAgePolicyWriteModel struct { diff --git a/internal/v2/command/iam_policy_password_complexity.go b/internal/command/iam_policy_password_complexity.go similarity index 95% rename from internal/v2/command/iam_policy_password_complexity.go rename to internal/command/iam_policy_password_complexity.go index c191d70877..829439c831 100644 --- a/internal/v2/command/iam_policy_password_complexity.go +++ b/internal/command/iam_policy_password_complexity.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) getDefaultPasswordComplexityPolicy(ctx context.Context) (*domain.PasswordComplexityPolicy, error) { diff --git a/internal/v2/command/iam_policy_password_complexity_model.go b/internal/command/iam_policy_password_complexity_model.go similarity index 92% rename from internal/v2/command/iam_policy_password_complexity_model.go rename to internal/command/iam_policy_password_complexity_model.go index 0dc0fbca36..667309bb94 100644 --- a/internal/v2/command/iam_policy_password_complexity_model.go +++ b/internal/command/iam_policy_password_complexity_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMPasswordComplexityPolicyWriteModel struct { diff --git a/internal/v2/command/iam_policy_password_lockout.go b/internal/command/iam_policy_password_lockout.go similarity index 94% rename from internal/v2/command/iam_policy_password_lockout.go rename to internal/command/iam_policy_password_lockout.go index 0f9e5d3dfd..4d84b25215 100644 --- a/internal/v2/command/iam_policy_password_lockout.go +++ b/internal/command/iam_policy_password_lockout.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) func (r *CommandSide) AddDefaultPasswordLockoutPolicy(ctx context.Context, policy *domain.PasswordLockoutPolicy) (*domain.PasswordLockoutPolicy, error) { diff --git a/internal/v2/command/iam_policy_password_lockout_model.go b/internal/command/iam_policy_password_lockout_model.go similarity index 90% rename from internal/v2/command/iam_policy_password_lockout_model.go rename to internal/command/iam_policy_password_lockout_model.go index 9775a2bfb5..3896697b2d 100644 --- a/internal/v2/command/iam_policy_password_lockout_model.go +++ b/internal/command/iam_policy_password_lockout_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMPasswordLockoutPolicyWriteModel struct { diff --git a/internal/v2/command/identity_provider_model.go b/internal/command/identity_provider_model.go similarity index 80% rename from internal/v2/command/identity_provider_model.go rename to internal/command/identity_provider_model.go index c6ad36f287..4375fa0041 100644 --- a/internal/v2/command/identity_provider_model.go +++ b/internal/command/identity_provider_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type IdentityProviderWriteModel struct { diff --git a/internal/v2/command/idp_config_model.go b/internal/command/idp_config_model.go similarity index 92% rename from internal/v2/command/idp_config_model.go rename to internal/command/idp_config_model.go index 24834c57b5..93d0f370c8 100644 --- a/internal/v2/command/idp_config_model.go +++ b/internal/command/idp_config_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/idpconfig" ) type IDPConfigWriteModel struct { diff --git a/internal/v2/command/key_pair.go b/internal/command/key_pair.go similarity index 90% rename from internal/v2/command/key_pair.go rename to internal/command/key_pair.go index 4b43b708ad..cbaf914969 100644 --- a/internal/v2/command/key_pair.go +++ b/internal/command/key_pair.go @@ -4,8 +4,8 @@ import ( "context" "github.com/caos/zitadel/internal/api/authz" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/v2/domain" - keypair "github.com/caos/zitadel/internal/v2/repository/keypair" + "github.com/caos/zitadel/internal/domain" + keypair "github.com/caos/zitadel/internal/repository/keypair" "time" ) diff --git a/internal/v2/command/key_pair_model.go b/internal/command/key_pair_model.go similarity index 86% rename from internal/v2/command/key_pair_model.go rename to internal/command/key_pair_model.go index 126f25a084..4275f1d9bd 100644 --- a/internal/v2/command/key_pair_model.go +++ b/internal/command/key_pair_model.go @@ -1,10 +1,10 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - keypair "github.com/caos/zitadel/internal/v2/repository/keypair" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + keypair "github.com/caos/zitadel/internal/repository/keypair" + "github.com/caos/zitadel/internal/repository/project" ) type KeyPairWriteModel struct { diff --git a/internal/v2/command/member_model.go b/internal/command/member_model.go similarity index 81% rename from internal/v2/command/member_model.go rename to internal/command/member_model.go index e4f86eaa72..6709962db9 100644 --- a/internal/v2/command/member_model.go +++ b/internal/command/member_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/member" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/member" ) type MemberWriteModel struct { diff --git a/internal/v2/command/oidc_config_model.go b/internal/command/oidc_config_model.go similarity index 92% rename from internal/v2/command/oidc_config_model.go rename to internal/command/oidc_config_model.go index c1699e96b0..6fa34d3ae8 100644 --- a/internal/v2/command/oidc_config_model.go +++ b/internal/command/oidc_config_model.go @@ -2,9 +2,9 @@ package command import ( "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/idpconfig" ) type OIDCConfigWriteModel struct { diff --git a/internal/v2/command/org.go b/internal/command/org.go similarity index 97% rename from internal/v2/command/org.go rename to internal/command/org.go index bac6ac8b84..22e1e2d97f 100644 --- a/internal/v2/command/org.go +++ b/internal/command/org.go @@ -2,11 +2,10 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) getOrg(ctx context.Context, orgID string) (*domain.Org, error) { diff --git a/internal/v2/command/org_converter.go b/internal/command/org_converter.go similarity index 96% rename from internal/v2/command/org_converter.go rename to internal/command/org_converter.go index e7732b9347..9564df1998 100644 --- a/internal/v2/command/org_converter.go +++ b/internal/command/org_converter.go @@ -1,7 +1,7 @@ package command import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) func orgWriteModelToOrg(wm *OrgWriteModel) *domain.Org { diff --git a/internal/v2/command/org_domain.go b/internal/command/org_domain.go similarity index 98% rename from internal/v2/command/org_domain.go rename to internal/command/org_domain.go index 0c1103d75e..d9812d6a02 100644 --- a/internal/v2/command/org_domain.go +++ b/internal/command/org_domain.go @@ -2,15 +2,14 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" http_utils "github.com/caos/zitadel/internal/api/http" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) AddOrgDomain(ctx context.Context, orgDomain *domain.OrgDomain) (*domain.OrgDomain, error) { diff --git a/internal/v2/command/org_domain_model.go b/internal/command/org_domain_model.go similarity index 94% rename from internal/v2/command/org_domain_model.go rename to internal/command/org_domain_model.go index 1e4da098bc..e9a77b7a6c 100644 --- a/internal/v2/command/org_domain_model.go +++ b/internal/command/org_domain_model.go @@ -2,9 +2,9 @@ package command import ( "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" ) type OrgDomainWriteModel struct { diff --git a/internal/v2/command/org_idp_config.go b/internal/command/org_idp_config.go similarity index 96% rename from internal/v2/command/org_idp_config.go rename to internal/command/org_idp_config.go index ade4a336dd..e18a05750b 100644 --- a/internal/v2/command/org_idp_config.go +++ b/internal/command/org_idp_config.go @@ -2,15 +2,14 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - org_repo "github.com/caos/zitadel/internal/v2/repository/org" + org_repo "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) AddIDPConfig(ctx context.Context, config *domain.IDPConfig) (*domain.IDPConfig, error) { diff --git a/internal/v2/command/org_idp_config_model.go b/internal/command/org_idp_config_model.go similarity index 93% rename from internal/v2/command/org_idp_config_model.go rename to internal/command/org_idp_config_model.go index c1b062f1bb..a9a4ab755e 100644 --- a/internal/v2/command/org_idp_config_model.go +++ b/internal/command/org_idp_config_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/idpconfig" + "github.com/caos/zitadel/internal/repository/org" ) type OrgIDPConfigWriteModel struct { diff --git a/internal/v2/command/org_idp_oidc_config.go b/internal/command/org_idp_oidc_config.go similarity index 96% rename from internal/v2/command/org_idp_oidc_config.go rename to internal/command/org_idp_oidc_config.go index ade56a3425..fd53eb1669 100644 --- a/internal/v2/command/org_idp_oidc_config.go +++ b/internal/command/org_idp_oidc_config.go @@ -2,8 +2,8 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" ) func (r *CommandSide) ChangeIDPOIDCConfig(ctx context.Context, config *domain.OIDCIDPConfig) (*domain.OIDCIDPConfig, error) { diff --git a/internal/v2/command/org_idp_oidc_config_model.go b/internal/command/org_idp_oidc_config_model.go similarity index 94% rename from internal/v2/command/org_idp_oidc_config_model.go rename to internal/command/org_idp_oidc_config_model.go index dbbc817b73..a82cf299ec 100644 --- a/internal/v2/command/org_idp_oidc_config_model.go +++ b/internal/command/org_idp_oidc_config_model.go @@ -2,13 +2,13 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "reflect" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/idpconfig" + "github.com/caos/zitadel/internal/repository/org" ) type IDPOIDCConfigWriteModel struct { diff --git a/internal/v2/command/org_member.go b/internal/command/org_member.go similarity index 95% rename from internal/v2/command/org_member.go rename to internal/command/org_member.go index c84a3dd7e9..da1d6da34c 100644 --- a/internal/v2/command/org_member.go +++ b/internal/command/org_member.go @@ -2,14 +2,14 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "reflect" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/repository/org" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" ) func (r *CommandSide) AddOrgMember(ctx context.Context, member *domain.Member) (*domain.Member, error) { diff --git a/internal/v2/command/org_member_model.go b/internal/command/org_member_model.go similarity index 93% rename from internal/v2/command/org_member_model.go rename to internal/command/org_member_model.go index a9c43e774d..5e60331112 100644 --- a/internal/v2/command/org_member_model.go +++ b/internal/command/org_member_model.go @@ -1,8 +1,8 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" ) type OrgMemberWriteModel struct { diff --git a/internal/v2/command/org_model.go b/internal/command/org_model.go similarity index 88% rename from internal/v2/command/org_model.go rename to internal/command/org_model.go index b55e8e88cd..d0714a5372 100644 --- a/internal/v2/command/org_model.go +++ b/internal/command/org_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" ) type OrgWriteModel struct { diff --git a/internal/v2/command/org_policy_label.go b/internal/command/org_policy_label.go similarity index 96% rename from internal/v2/command/org_policy_label.go rename to internal/command/org_policy_label.go index c0303f7a51..7177547693 100644 --- a/internal/v2/command/org_policy_label.go +++ b/internal/command/org_policy_label.go @@ -3,9 +3,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) AddLabelPolicy(ctx context.Context, resourceOwner string, policy *domain.LabelPolicy) (*domain.LabelPolicy, error) { diff --git a/internal/v2/command/org_policy_label_model.go b/internal/command/org_policy_label_model.go similarity index 91% rename from internal/v2/command/org_policy_label_model.go rename to internal/command/org_policy_label_model.go index a5d51df520..5df6f91998 100644 --- a/internal/v2/command/org_policy_label_model.go +++ b/internal/command/org_policy_label_model.go @@ -2,10 +2,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgLabelPolicyWriteModel struct { diff --git a/internal/v2/command/org_policy_login.go b/internal/command/org_policy_login.go similarity index 98% rename from internal/v2/command/org_policy_login.go rename to internal/command/org_policy_login.go index 31674b628b..887922b08e 100644 --- a/internal/v2/command/org_policy_login.go +++ b/internal/command/org_policy_login.go @@ -3,10 +3,10 @@ package command import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) AddLoginPolicy(ctx context.Context, resourceOwner string, policy *domain.LoginPolicy) (*domain.LoginPolicy, error) { diff --git a/internal/v2/command/org_policy_login_factors_model.go b/internal/command/org_policy_login_factors_model.go similarity index 95% rename from internal/v2/command/org_policy_login_factors_model.go rename to internal/command/org_policy_login_factors_model.go index fc8a060e0a..8c086e1717 100644 --- a/internal/v2/command/org_policy_login_factors_model.go +++ b/internal/command/org_policy_login_factors_model.go @@ -1,8 +1,8 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" ) type OrgSecondFactorWriteModel struct { diff --git a/internal/v2/command/org_policy_login_identity_provider_model.go b/internal/command/org_policy_login_identity_provider_model.go similarity index 91% rename from internal/v2/command/org_policy_login_identity_provider_model.go rename to internal/command/org_policy_login_identity_provider_model.go index 8545cd5867..bff3cc0f42 100644 --- a/internal/v2/command/org_policy_login_identity_provider_model.go +++ b/internal/command/org_policy_login_identity_provider_model.go @@ -1,8 +1,8 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) type OrgIdentityProviderWriteModel struct { diff --git a/internal/v2/command/org_policy_login_model.go b/internal/command/org_policy_login_model.go similarity index 92% rename from internal/v2/command/org_policy_login_model.go rename to internal/command/org_policy_login_model.go index 4314bdf9b4..e23c1e478b 100644 --- a/internal/v2/command/org_policy_login_model.go +++ b/internal/command/org_policy_login_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgLoginPolicyWriteModel struct { diff --git a/internal/v2/command/org_policy_mail_template.go b/internal/command/org_policy_mail_template.go similarity index 96% rename from internal/v2/command/org_policy_mail_template.go rename to internal/command/org_policy_mail_template.go index c7c47463cc..adc97decd3 100644 --- a/internal/v2/command/org_policy_mail_template.go +++ b/internal/command/org_policy_mail_template.go @@ -3,9 +3,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) AddMailTemplate(ctx context.Context, resourceOwner string, policy *domain.MailTemplate) (*domain.MailTemplate, error) { diff --git a/internal/v2/command/org_policy_mail_template_model.go b/internal/command/org_policy_mail_template_model.go similarity index 92% rename from internal/v2/command/org_policy_mail_template_model.go rename to internal/command/org_policy_mail_template_model.go index 5b64e7e35e..3545583f53 100644 --- a/internal/v2/command/org_policy_mail_template_model.go +++ b/internal/command/org_policy_mail_template_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "reflect" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgMailTemplateWriteModel struct { diff --git a/internal/v2/command/org_policy_mail_text.go b/internal/command/org_policy_mail_text.go similarity index 97% rename from internal/v2/command/org_policy_mail_text.go rename to internal/command/org_policy_mail_text.go index 962cadd260..82842d3d42 100644 --- a/internal/v2/command/org_policy_mail_text.go +++ b/internal/command/org_policy_mail_text.go @@ -3,9 +3,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) AddMailText(ctx context.Context, resourceOwner string, mailText *domain.MailText) (*domain.MailText, error) { diff --git a/internal/v2/command/org_policy_mail_text_model.go b/internal/command/org_policy_mail_text_model.go similarity index 93% rename from internal/v2/command/org_policy_mail_text_model.go rename to internal/command/org_policy_mail_text_model.go index 723fa9643a..ae8a8cc9e5 100644 --- a/internal/v2/command/org_policy_mail_text_model.go +++ b/internal/command/org_policy_mail_text_model.go @@ -2,9 +2,9 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgMailTextWriteModel struct { diff --git a/internal/v2/command/org_policy_org_iam.go b/internal/command/org_policy_org_iam.go similarity index 96% rename from internal/v2/command/org_policy_org_iam.go rename to internal/command/org_policy_org_iam.go index 9a35250f1f..6283707fb7 100644 --- a/internal/v2/command/org_policy_org_iam.go +++ b/internal/command/org_policy_org_iam.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" ) func (r *CommandSide) AddOrgIAMPolicy(ctx context.Context, resourceOwner string, policy *domain.OrgIAMPolicy) (*domain.OrgIAMPolicy, error) { diff --git a/internal/v2/command/org_policy_org_iam_model.go b/internal/command/org_policy_org_iam_model.go similarity index 92% rename from internal/v2/command/org_policy_org_iam_model.go rename to internal/command/org_policy_org_iam_model.go index 8cd18f3f1f..6643772a1f 100644 --- a/internal/v2/command/org_policy_org_iam_model.go +++ b/internal/command/org_policy_org_iam_model.go @@ -2,10 +2,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type ORGOrgIAMPolicyWriteModel struct { diff --git a/internal/v2/command/org_policy_password_age.go b/internal/command/org_policy_password_age.go similarity index 96% rename from internal/v2/command/org_policy_password_age.go rename to internal/command/org_policy_password_age.go index 60f034f033..7663f79f1a 100644 --- a/internal/v2/command/org_policy_password_age.go +++ b/internal/command/org_policy_password_age.go @@ -3,9 +3,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) AddPasswordAgePolicy(ctx context.Context, resourceOwner string, policy *domain.PasswordAgePolicy) (*domain.PasswordAgePolicy, error) { diff --git a/internal/v2/command/org_policy_password_age_model.go b/internal/command/org_policy_password_age_model.go similarity index 92% rename from internal/v2/command/org_policy_password_age_model.go rename to internal/command/org_policy_password_age_model.go index 08c6745cc5..fdb54b2d67 100644 --- a/internal/v2/command/org_policy_password_age_model.go +++ b/internal/command/org_policy_password_age_model.go @@ -2,10 +2,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgPasswordAgePolicyWriteModel struct { diff --git a/internal/v2/command/org_policy_password_complexity.go b/internal/command/org_policy_password_complexity.go similarity index 97% rename from internal/v2/command/org_policy_password_complexity.go rename to internal/command/org_policy_password_complexity.go index 452b12205e..499b34d841 100644 --- a/internal/v2/command/org_policy_password_complexity.go +++ b/internal/command/org_policy_password_complexity.go @@ -3,9 +3,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) getOrgPasswordComplexityPolicy(ctx context.Context, orgID string) (*domain.PasswordComplexityPolicy, error) { diff --git a/internal/v2/command/org_policy_password_complexity_model.go b/internal/command/org_policy_password_complexity_model.go similarity index 94% rename from internal/v2/command/org_policy_password_complexity_model.go rename to internal/command/org_policy_password_complexity_model.go index 8739d9857a..3191945884 100644 --- a/internal/v2/command/org_policy_password_complexity_model.go +++ b/internal/command/org_policy_password_complexity_model.go @@ -2,10 +2,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgPasswordComplexityPolicyWriteModel struct { diff --git a/internal/v2/command/org_policy_password_lockout.go b/internal/command/org_policy_password_lockout.go similarity index 96% rename from internal/v2/command/org_policy_password_lockout.go rename to internal/command/org_policy_password_lockout.go index 7ececefa51..2ff5ea1d93 100644 --- a/internal/v2/command/org_policy_password_lockout.go +++ b/internal/command/org_policy_password_lockout.go @@ -2,9 +2,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/repository/org" ) func (r *CommandSide) AddPasswordLockoutPolicy(ctx context.Context, resourceOwner string, policy *domain.PasswordLockoutPolicy) (*domain.PasswordLockoutPolicy, error) { diff --git a/internal/v2/command/org_policy_password_lockout_model.go b/internal/command/org_policy_password_lockout_model.go similarity index 93% rename from internal/v2/command/org_policy_password_lockout_model.go rename to internal/command/org_policy_password_lockout_model.go index 29d8eea9b9..84af325c11 100644 --- a/internal/v2/command/org_policy_password_lockout_model.go +++ b/internal/command/org_policy_password_lockout_model.go @@ -2,10 +2,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgPasswordLockoutPolicyWriteModel struct { diff --git a/internal/v2/command/policy_label_model.go b/internal/command/policy_label_model.go similarity index 82% rename from internal/v2/command/policy_label_model.go rename to internal/command/policy_label_model.go index 30462617b2..1e44b87984 100644 --- a/internal/v2/command/policy_label_model.go +++ b/internal/command/policy_label_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type LabelPolicyWriteModel struct { diff --git a/internal/v2/command/policy_login_factors_model.go b/internal/command/policy_login_factors_model.go similarity index 86% rename from internal/v2/command/policy_login_factors_model.go rename to internal/command/policy_login_factors_model.go index e8004aa4d7..9ef21afcd3 100644 --- a/internal/v2/command/policy_login_factors_model.go +++ b/internal/command/policy_login_factors_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type SecondFactorWriteModel struct { diff --git a/internal/v2/command/policy_login_model.go b/internal/command/policy_login_model.go similarity index 89% rename from internal/v2/command/policy_login_model.go rename to internal/command/policy_login_model.go index ee42524ac9..affb9fac6f 100644 --- a/internal/v2/command/policy_login_model.go +++ b/internal/command/policy_login_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type LoginPolicyWriteModel struct { diff --git a/internal/v2/command/policy_mail_template_model.go b/internal/command/policy_mail_template_model.go similarity index 79% rename from internal/v2/command/policy_mail_template_model.go rename to internal/command/policy_mail_template_model.go index bbf6950329..ef7e340a34 100644 --- a/internal/v2/command/policy_mail_template_model.go +++ b/internal/command/policy_mail_template_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type MailTemplateWriteModel struct { diff --git a/internal/v2/command/policy_mail_text_model.go b/internal/command/policy_mail_text_model.go similarity index 89% rename from internal/v2/command/policy_mail_text_model.go rename to internal/command/policy_mail_text_model.go index ad1fe4c226..2d112bab8f 100644 --- a/internal/v2/command/policy_mail_text_model.go +++ b/internal/command/policy_mail_text_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type MailTextWriteModel struct { diff --git a/internal/v2/command/policy_org_iam_model.go b/internal/command/policy_org_iam_model.go similarity index 79% rename from internal/v2/command/policy_org_iam_model.go rename to internal/command/policy_org_iam_model.go index 5b95c619f9..68f05ecd6a 100644 --- a/internal/v2/command/policy_org_iam_model.go +++ b/internal/command/policy_org_iam_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type PolicyOrgIAMWriteModel struct { diff --git a/internal/v2/command/policy_password_age_model.go b/internal/command/policy_password_age_model.go similarity index 83% rename from internal/v2/command/policy_password_age_model.go rename to internal/command/policy_password_age_model.go index 3883f40988..04056b4986 100644 --- a/internal/v2/command/policy_password_age_model.go +++ b/internal/command/policy_password_age_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type PasswordAgePolicyWriteModel struct { diff --git a/internal/v2/command/policy_password_complexity_model.go b/internal/command/policy_password_complexity_model.go similarity index 88% rename from internal/v2/command/policy_password_complexity_model.go rename to internal/command/policy_password_complexity_model.go index 67ac2580bd..1de3b2c7ab 100644 --- a/internal/v2/command/policy_password_complexity_model.go +++ b/internal/command/policy_password_complexity_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type PasswordComplexityPolicyWriteModel struct { diff --git a/internal/v2/command/policy_password_lockout_model.go b/internal/command/policy_password_lockout_model.go similarity index 84% rename from internal/v2/command/policy_password_lockout_model.go rename to internal/command/policy_password_lockout_model.go index 4049d05f7b..89c7a3db6f 100644 --- a/internal/v2/command/policy_password_lockout_model.go +++ b/internal/command/policy_password_lockout_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type PasswordLockoutPolicyWriteModel struct { diff --git a/internal/v2/command/project.go b/internal/command/project.go similarity index 97% rename from internal/v2/command/project.go rename to internal/command/project.go index 153aec374d..154934139e 100644 --- a/internal/v2/command/project.go +++ b/internal/command/project.go @@ -3,10 +3,10 @@ package command import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) func (r *CommandSide) AddProject(ctx context.Context, project *domain.Project, resourceOwner, ownerUserID string) (_ *domain.Project, err error) { diff --git a/internal/v2/command/project_application.go b/internal/command/project_application.go similarity index 97% rename from internal/v2/command/project_application.go rename to internal/command/project_application.go index c3b87ac4fd..a6ab13acc2 100644 --- a/internal/v2/command/project_application.go +++ b/internal/command/project_application.go @@ -2,9 +2,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/repository/project" ) func (r *CommandSide) ChangeApplication(ctx context.Context, projectID string, appChange domain.Application, resourceOwner string) (domain.Application, error) { diff --git a/internal/v2/command/project_application_api.go b/internal/command/project_application_api.go similarity index 96% rename from internal/v2/command/project_application_api.go rename to internal/command/project_application_api.go index e9b8a68c53..e44c60e197 100644 --- a/internal/v2/command/project_application_api.go +++ b/internal/command/project_application_api.go @@ -2,10 +2,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) func (r *CommandSide) AddAPIApplication(ctx context.Context, application *domain.APIApp, resourceOwner string) (_ *domain.APIApp, err error) { diff --git a/internal/v2/command/project_application_api_model.go b/internal/command/project_application_api_model.go similarity index 96% rename from internal/v2/command/project_application_api_model.go rename to internal/command/project_application_api_model.go index c4c3c7732e..be0ef0d241 100644 --- a/internal/v2/command/project_application_api_model.go +++ b/internal/command/project_application_api_model.go @@ -2,11 +2,11 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/project" ) type APIApplicationWriteModel struct { diff --git a/internal/v2/command/project_application_key.go b/internal/command/project_application_key.go similarity index 95% rename from internal/v2/command/project_application_key.go rename to internal/command/project_application_key.go index 4ba3cec35f..d259332a31 100644 --- a/internal/v2/command/project_application_key.go +++ b/internal/command/project_application_key.go @@ -3,9 +3,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/repository/project" ) func (r *CommandSide) AddApplicationKey(ctx context.Context, key *domain.ApplicationKey, resourceOwner string) (_ *domain.ApplicationKey, err error) { diff --git a/internal/v2/command/project_application_key_model.go b/internal/command/project_application_key_model.go similarity index 96% rename from internal/v2/command/project_application_key_model.go rename to internal/command/project_application_key_model.go index 429150a93e..979d7f3a21 100644 --- a/internal/v2/command/project_application_key_model.go +++ b/internal/command/project_application_key_model.go @@ -1,11 +1,11 @@ package command import ( + "github.com/caos/zitadel/internal/eventstore" "time" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/project" ) type ApplicationKeyWriteModel struct { diff --git a/internal/v2/command/project_application_model.go b/internal/command/project_application_model.go similarity index 94% rename from internal/v2/command/project_application_model.go rename to internal/command/project_application_model.go index 31c9288b1f..f106bc2b96 100644 --- a/internal/v2/command/project_application_model.go +++ b/internal/command/project_application_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) type ApplicationWriteModel struct { diff --git a/internal/v2/command/project_application_oidc.go b/internal/command/project_application_oidc.go similarity index 97% rename from internal/v2/command/project_application_oidc.go rename to internal/command/project_application_oidc.go index 87cdb22f2f..e2b2ead3ef 100644 --- a/internal/v2/command/project_application_oidc.go +++ b/internal/command/project_application_oidc.go @@ -2,15 +2,15 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/repository/project" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" ) func (r *CommandSide) AddOIDCApplication(ctx context.Context, application *domain.OIDCApp, resourceOwner string) (_ *domain.OIDCApp, err error) { diff --git a/internal/v2/command/project_application_oidc_model.go b/internal/command/project_application_oidc_model.go similarity index 98% rename from internal/v2/command/project_application_oidc_model.go rename to internal/command/project_application_oidc_model.go index 1334f6830a..2a39778c98 100644 --- a/internal/v2/command/project_application_oidc_model.go +++ b/internal/command/project_application_oidc_model.go @@ -3,9 +3,9 @@ package command import ( "context" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" "reflect" "time" ) diff --git a/internal/v2/command/project_converter.go b/internal/command/project_converter.go similarity index 98% rename from internal/v2/command/project_converter.go rename to internal/command/project_converter.go index ff2489af67..0409b8f86a 100644 --- a/internal/v2/command/project_converter.go +++ b/internal/command/project_converter.go @@ -1,7 +1,7 @@ package command import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) func projectWriteModelToProject(writeModel *ProjectWriteModel) *domain.Project { diff --git a/internal/v2/command/project_grant.go b/internal/command/project_grant.go similarity index 98% rename from internal/v2/command/project_grant.go rename to internal/command/project_grant.go index 433d5fd4d6..62a7288623 100644 --- a/internal/v2/command/project_grant.go +++ b/internal/command/project_grant.go @@ -3,11 +3,11 @@ package command import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" "reflect" ) diff --git a/internal/v2/command/project_grant_member.go b/internal/command/project_grant_member.go similarity index 97% rename from internal/v2/command/project_grant_member.go rename to internal/command/project_grant_member.go index 0f366ff824..644febda6b 100644 --- a/internal/v2/command/project_grant_member.go +++ b/internal/command/project_grant_member.go @@ -4,11 +4,11 @@ import ( "context" "reflect" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/repository/project" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" ) func (r *CommandSide) AddProjectGrantMember(ctx context.Context, member *domain.ProjectGrantMember, resourceOwner string) (*domain.ProjectGrantMember, error) { diff --git a/internal/v2/command/project_grant_member_model.go b/internal/command/project_grant_member_model.go similarity index 93% rename from internal/v2/command/project_grant_member_model.go rename to internal/command/project_grant_member_model.go index 128ed067f5..c0e19ca433 100644 --- a/internal/v2/command/project_grant_member_model.go +++ b/internal/command/project_grant_member_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) type ProjectGrantMemberWriteModel struct { diff --git a/internal/v2/command/project_grant_model.go b/internal/command/project_grant_model.go similarity index 94% rename from internal/v2/command/project_grant_model.go rename to internal/command/project_grant_model.go index 3222bd001f..e4b4081625 100644 --- a/internal/v2/command/project_grant_model.go +++ b/internal/command/project_grant_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) type ProjectGrantWriteModel struct { diff --git a/internal/v2/command/project_member.go b/internal/command/project_member.go similarity index 96% rename from internal/v2/command/project_member.go rename to internal/command/project_member.go index 23c7f2ed41..baf956d1a5 100644 --- a/internal/v2/command/project_member.go +++ b/internal/command/project_member.go @@ -2,14 +2,14 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" "reflect" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/repository/project" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" ) func (r *CommandSide) AddProjectMember(ctx context.Context, member *domain.Member, resourceOwner string) (*domain.Member, error) { diff --git a/internal/v2/command/project_member_model.go b/internal/command/project_member_model.go similarity index 93% rename from internal/v2/command/project_member_model.go rename to internal/command/project_member_model.go index becfd9b743..83b934bb39 100644 --- a/internal/v2/command/project_member_model.go +++ b/internal/command/project_member_model.go @@ -1,8 +1,8 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) type ProjectMemberWriteModel struct { diff --git a/internal/v2/command/project_model.go b/internal/command/project_model.go similarity index 94% rename from internal/v2/command/project_model.go rename to internal/command/project_model.go index 1a853be8ee..32cfe1dfdd 100644 --- a/internal/v2/command/project_model.go +++ b/internal/command/project_model.go @@ -2,9 +2,9 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) type ProjectWriteModel struct { diff --git a/internal/v2/command/project_role.go b/internal/command/project_role.go similarity index 97% rename from internal/v2/command/project_role.go rename to internal/command/project_role.go index 0c32f848ce..0db2ba396f 100644 --- a/internal/v2/command/project_role.go +++ b/internal/command/project_role.go @@ -3,10 +3,10 @@ package command import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) func (r *CommandSide) AddProjectRole(ctx context.Context, projectRole *domain.ProjectRole, resourceOwner string) (_ *domain.ProjectRole, err error) { diff --git a/internal/v2/command/project_role_model.go b/internal/command/project_role_model.go similarity index 94% rename from internal/v2/command/project_role_model.go rename to internal/command/project_role_model.go index 9aa03ca46a..ee49de6952 100644 --- a/internal/v2/command/project_role_model.go +++ b/internal/command/project_role_model.go @@ -2,9 +2,9 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/project" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/project" ) type ProjectRoleWriteModel struct { diff --git a/internal/v2/command/setup.go b/internal/command/setup.go similarity index 92% rename from internal/v2/command/setup.go rename to internal/command/setup.go index 1e7154ed88..1236fde62e 100644 --- a/internal/v2/command/setup.go +++ b/internal/command/setup.go @@ -2,15 +2,14 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/api/authz" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/eventstore/v1/models" + iam_repo "github.com/caos/zitadel/internal/repository/iam" ) type Step interface { diff --git a/internal/v2/command/setup_step1.go b/internal/command/setup_step1.go similarity index 97% rename from internal/v2/command/setup_step1.go rename to internal/command/setup_step1.go index f2406b5a7e..af051b8ba3 100644 --- a/internal/v2/command/setup_step1.go +++ b/internal/command/setup_step1.go @@ -2,15 +2,15 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" + iam_repo "github.com/caos/zitadel/internal/repository/iam" ) const ( diff --git a/internal/v2/command/setup_step10.go b/internal/command/setup_step10.go similarity index 92% rename from internal/v2/command/setup_step10.go rename to internal/command/setup_step10.go index 677669ac87..46392fc9f3 100644 --- a/internal/v2/command/setup_step10.go +++ b/internal/command/setup_step10.go @@ -3,8 +3,8 @@ package command import ( "context" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" ) type Step10 struct { diff --git a/internal/v2/command/setup_step11.go b/internal/command/setup_step11.go similarity index 87% rename from internal/v2/command/setup_step11.go rename to internal/command/setup_step11.go index 9f735d305d..fadc177383 100644 --- a/internal/v2/command/setup_step11.go +++ b/internal/command/setup_step11.go @@ -3,9 +3,9 @@ package command import ( "context" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + iam_repo "github.com/caos/zitadel/internal/repository/iam" ) type Step11 struct { diff --git a/internal/v2/command/setup_step2.go b/internal/command/setup_step2.go similarity index 92% rename from internal/v2/command/setup_step2.go rename to internal/command/setup_step2.go index 47279602ee..da961a9d07 100644 --- a/internal/v2/command/setup_step2.go +++ b/internal/command/setup_step2.go @@ -2,12 +2,11 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" ) type Step2 struct { diff --git a/internal/v2/command/setup_step3.go b/internal/command/setup_step3.go similarity index 91% rename from internal/v2/command/setup_step3.go rename to internal/command/setup_step3.go index 1ed0f664aa..d4e6361e3a 100644 --- a/internal/v2/command/setup_step3.go +++ b/internal/command/setup_step3.go @@ -2,12 +2,11 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" ) type Step3 struct { diff --git a/internal/v2/command/setup_step4.go b/internal/command/setup_step4.go similarity index 91% rename from internal/v2/command/setup_step4.go rename to internal/command/setup_step4.go index b516ebd192..b6114ddd61 100644 --- a/internal/v2/command/setup_step4.go +++ b/internal/command/setup_step4.go @@ -2,12 +2,11 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" ) type Step4 struct { diff --git a/internal/v2/command/setup_step5.go b/internal/command/setup_step5.go similarity index 90% rename from internal/v2/command/setup_step5.go rename to internal/command/setup_step5.go index 3f36738ad5..78e0bb87de 100644 --- a/internal/v2/command/setup_step5.go +++ b/internal/command/setup_step5.go @@ -2,12 +2,11 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" ) type Step5 struct { diff --git a/internal/v2/command/setup_step6.go b/internal/command/setup_step6.go similarity index 91% rename from internal/v2/command/setup_step6.go rename to internal/command/setup_step6.go index ddcff9023d..bfa6b7ff03 100644 --- a/internal/v2/command/setup_step6.go +++ b/internal/command/setup_step6.go @@ -2,12 +2,11 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" ) type Step6 struct { diff --git a/internal/v2/command/setup_step7.go b/internal/command/setup_step7.go similarity index 90% rename from internal/v2/command/setup_step7.go rename to internal/command/setup_step7.go index cdc55ee2c8..ab868186f9 100644 --- a/internal/v2/command/setup_step7.go +++ b/internal/command/setup_step7.go @@ -2,11 +2,10 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) type Step7 struct { diff --git a/internal/v2/command/setup_step8.go b/internal/command/setup_step8.go similarity index 90% rename from internal/v2/command/setup_step8.go rename to internal/command/setup_step8.go index c0f8cf4322..0a308bb764 100644 --- a/internal/v2/command/setup_step8.go +++ b/internal/command/setup_step8.go @@ -2,11 +2,10 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) type Step8 struct { diff --git a/internal/v2/command/setup_step9.go b/internal/command/setup_step9.go similarity index 94% rename from internal/v2/command/setup_step9.go rename to internal/command/setup_step9.go index d5494f626d..bbf1e0e887 100644 --- a/internal/v2/command/setup_step9.go +++ b/internal/command/setup_step9.go @@ -2,11 +2,10 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) type Step9 struct { diff --git a/internal/v2/command/unique_constraints_model.go b/internal/command/unique_constraints_model.go similarity index 95% rename from internal/v2/command/unique_constraints_model.go rename to internal/command/unique_constraints_model.go index d13c0ead57..4995bdbf42 100644 --- a/internal/v2/command/unique_constraints_model.go +++ b/internal/command/unique_constraints_model.go @@ -3,16 +3,16 @@ package command import ( "context" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" - "github.com/caos/zitadel/internal/v2/repository/member" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" - "github.com/caos/zitadel/internal/v2/repository/project" - "github.com/caos/zitadel/internal/v2/repository/user" - "github.com/caos/zitadel/internal/v2/repository/usergrant" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/idpconfig" + "github.com/caos/zitadel/internal/repository/member" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" + "github.com/caos/zitadel/internal/repository/project" + "github.com/caos/zitadel/internal/repository/user" + "github.com/caos/zitadel/internal/repository/usergrant" ) type UniqueConstraintReadModel struct { diff --git a/internal/v2/command/user.go b/internal/command/user.go similarity index 97% rename from internal/v2/command/user.go rename to internal/command/user.go index 5f73de504c..08eef70af8 100644 --- a/internal/v2/command/user.go +++ b/internal/command/user.go @@ -3,16 +3,16 @@ package command import ( "context" "fmt" + "github.com/caos/zitadel/internal/eventstore" "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" ) func (cs *CommandSide) ChangeUsername(ctx context.Context, orgID, userID, userName string) error { diff --git a/internal/v2/command/user_converter.go b/internal/command/user_converter.go similarity index 97% rename from internal/v2/command/user_converter.go rename to internal/command/user_converter.go index f08c47e140..6793ff2697 100644 --- a/internal/v2/command/user_converter.go +++ b/internal/command/user_converter.go @@ -1,8 +1,8 @@ package command import ( - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) func writeModelToHuman(wm *HumanWriteModel) *domain.Human { diff --git a/internal/v2/command/user_grant.go b/internal/command/user_grant.go similarity index 98% rename from internal/v2/command/user_grant.go rename to internal/command/user_grant.go index 304b56357f..a6e92f355e 100644 --- a/internal/v2/command/user_grant.go +++ b/internal/command/user_grant.go @@ -2,13 +2,13 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "reflect" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/repository/usergrant" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/usergrant" ) func (r *CommandSide) AddUserGrant(ctx context.Context, usergrant *domain.UserGrant, resourceOwner string) (_ *domain.UserGrant, err error) { diff --git a/internal/v2/command/user_grant_converter.go b/internal/command/user_grant_converter.go similarity index 88% rename from internal/v2/command/user_grant_converter.go rename to internal/command/user_grant_converter.go index da7e09e574..7910d9812e 100644 --- a/internal/v2/command/user_grant_converter.go +++ b/internal/command/user_grant_converter.go @@ -1,6 +1,6 @@ package command -import "github.com/caos/zitadel/internal/v2/domain" +import "github.com/caos/zitadel/internal/domain" func userGrantWriteModelToUserGrant(writeModel *UserGrantWriteModel) *domain.UserGrant { return &domain.UserGrant{ diff --git a/internal/v2/command/user_grant_model.go b/internal/command/user_grant_model.go similarity index 93% rename from internal/v2/command/user_grant_model.go rename to internal/command/user_grant_model.go index 61d825dc34..6421d64f88 100644 --- a/internal/v2/command/user_grant_model.go +++ b/internal/command/user_grant_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/usergrant" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/usergrant" ) type UserGrantWriteModel struct { diff --git a/internal/v2/command/user_human.go b/internal/command/user_human.go similarity index 97% rename from internal/v2/command/user_human.go rename to internal/command/user_human.go index c35cff51e9..4711b27855 100644 --- a/internal/v2/command/user_human.go +++ b/internal/command/user_human.go @@ -2,13 +2,12 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/v2" - + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/repository/user" ) func (r *CommandSide) getHuman(ctx context.Context, userID, resourceowner string) (*domain.Human, error) { diff --git a/internal/v2/command/user_human_address.go b/internal/command/user_human_address.go similarity index 97% rename from internal/v2/command/user_human_address.go rename to internal/command/user_human_address.go index 2c877961c3..2f55889b66 100644 --- a/internal/v2/command/user_human_address.go +++ b/internal/command/user_human_address.go @@ -2,9 +2,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" ) func (r *CommandSide) ChangeHumanAddress(ctx context.Context, address *domain.Address) (*domain.Address, error) { diff --git a/internal/v2/command/user_human_address_model.go b/internal/command/user_human_address_model.go similarity index 94% rename from internal/v2/command/user_human_address_model.go rename to internal/command/user_human_address_model.go index dbf0328f54..990d818960 100644 --- a/internal/v2/command/user_human_address_model.go +++ b/internal/command/user_human_address_model.go @@ -2,10 +2,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) type HumanAddressWriteModel struct { diff --git a/internal/v2/command/user_human_email.go b/internal/command/user_human_email.go similarity index 97% rename from internal/v2/command/user_human_email.go rename to internal/command/user_human_email.go index a6da180b68..e9f62172e1 100644 --- a/internal/v2/command/user_human_email.go +++ b/internal/command/user_human_email.go @@ -4,11 +4,11 @@ import ( "context" "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" ) func (r *CommandSide) ChangeHumanEmail(ctx context.Context, email *domain.Email) (*domain.Email, error) { diff --git a/internal/v2/command/user_human_email_model.go b/internal/command/user_human_email_model.go similarity index 93% rename from internal/v2/command/user_human_email_model.go rename to internal/command/user_human_email_model.go index 3907db3ade..ee23317b07 100644 --- a/internal/v2/command/user_human_email_model.go +++ b/internal/command/user_human_email_model.go @@ -2,12 +2,12 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) type HumanEmailWriteModel struct { diff --git a/internal/v2/command/user_human_externalidp.go b/internal/command/user_human_externalidp.go similarity index 96% rename from internal/v2/command/user_human_externalidp.go rename to internal/command/user_human_externalidp.go index ef77c83f0d..d934cf83e6 100644 --- a/internal/v2/command/user_human_externalidp.go +++ b/internal/command/user_human_externalidp.go @@ -2,12 +2,12 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" ) func (r *CommandSide) BulkAddedHumanExternalIDP(ctx context.Context, userID, resourceOwner string, externalIDPs []*domain.ExternalIDP) (err error) { diff --git a/internal/v2/command/user_human_externalidp_model.go b/internal/command/user_human_externalidp_model.go similarity index 91% rename from internal/v2/command/user_human_externalidp_model.go rename to internal/command/user_human_externalidp_model.go index 662cce535d..7952910cbe 100644 --- a/internal/v2/command/user_human_externalidp_model.go +++ b/internal/command/user_human_externalidp_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/user" ) type HumanExternalIDPWriteModel struct { diff --git a/internal/v2/command/user_human_init.go b/internal/command/user_human_init.go similarity index 96% rename from internal/v2/command/user_human_init.go rename to internal/command/user_human_init.go index bcaafd3e23..8e37d0fcd2 100644 --- a/internal/v2/command/user_human_init.go +++ b/internal/command/user_human_init.go @@ -4,10 +4,10 @@ import ( "context" "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/user" ) //ResendInitialMail resend inital mail and changes email if provided diff --git a/internal/v2/command/user_human_init_model.go b/internal/command/user_human_init_model.go similarity index 93% rename from internal/v2/command/user_human_init_model.go rename to internal/command/user_human_init_model.go index f6e2a868fc..5a69a9673b 100644 --- a/internal/v2/command/user_human_init_model.go +++ b/internal/command/user_human_init_model.go @@ -2,12 +2,12 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) type HumanInitCodeWriteModel struct { diff --git a/internal/v2/command/user_human_model.go b/internal/command/user_human_model.go similarity index 97% rename from internal/v2/command/user_human_model.go rename to internal/command/user_human_model.go index 3fe424c1a9..b283c4c9a0 100644 --- a/internal/v2/command/user_human_model.go +++ b/internal/command/user_human_model.go @@ -2,9 +2,9 @@ package command import ( "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/user" "golang.org/x/text/language" ) diff --git a/internal/v2/command/user_human_otp.go b/internal/command/user_human_otp.go similarity index 97% rename from internal/v2/command/user_human_otp.go rename to internal/command/user_human_otp.go index 10fbd01f13..83a8cce8b8 100644 --- a/internal/v2/command/user_human_otp.go +++ b/internal/command/user_human_otp.go @@ -3,11 +3,11 @@ package command import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" ) func (r *CommandSide) AddHumanOTP(ctx context.Context, userID, resourceowner string) (*domain.OTP, error) { diff --git a/internal/v2/command/user_human_otp_model.go b/internal/command/user_human_otp_model.go similarity index 89% rename from internal/v2/command/user_human_otp_model.go rename to internal/command/user_human_otp_model.go index fb0ca7eee2..a4b9924f87 100644 --- a/internal/v2/command/user_human_otp_model.go +++ b/internal/command/user_human_otp_model.go @@ -2,9 +2,9 @@ package command import ( "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/user" ) type HumanOTPWriteModel struct { diff --git a/internal/v2/command/user_human_password.go b/internal/command/user_human_password.go similarity index 98% rename from internal/v2/command/user_human_password.go rename to internal/command/user_human_password.go index 1ae2f88ad2..1853b4ec74 100644 --- a/internal/v2/command/user_human_password.go +++ b/internal/command/user_human_password.go @@ -2,14 +2,13 @@ package command import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" ) func (r *CommandSide) SetOneTimePassword(ctx context.Context, orgID, userID, passwordString string) (err error) { diff --git a/internal/v2/command/user_human_password_model.go b/internal/command/user_human_password_model.go similarity index 92% rename from internal/v2/command/user_human_password_model.go rename to internal/command/user_human_password_model.go index 707eb0c3df..3e7cc32071 100644 --- a/internal/v2/command/user_human_password_model.go +++ b/internal/command/user_human_password_model.go @@ -1,12 +1,12 @@ package command import ( + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) type HumanPasswordWriteModel struct { diff --git a/internal/v2/command/user_human_phone.go b/internal/command/user_human_phone.go similarity index 97% rename from internal/v2/command/user_human_phone.go rename to internal/command/user_human_phone.go index 561a77cf81..da720ac5d1 100644 --- a/internal/v2/command/user_human_phone.go +++ b/internal/command/user_human_phone.go @@ -2,14 +2,14 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" ) func (r *CommandSide) ChangeHumanPhone(ctx context.Context, phone *domain.Phone) (*domain.Phone, error) { diff --git a/internal/v2/command/user_human_phone_model.go b/internal/command/user_human_phone_model.go similarity index 93% rename from internal/v2/command/user_human_phone_model.go rename to internal/command/user_human_phone_model.go index d74e260ec5..3f651c8634 100644 --- a/internal/v2/command/user_human_phone_model.go +++ b/internal/command/user_human_phone_model.go @@ -2,12 +2,12 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) type HumanPhoneWriteModel struct { diff --git a/internal/v2/command/user_human_profile.go b/internal/command/user_human_profile.go similarity index 97% rename from internal/v2/command/user_human_profile.go rename to internal/command/user_human_profile.go index b9f900985d..c7bd3d61c2 100644 --- a/internal/v2/command/user_human_profile.go +++ b/internal/command/user_human_profile.go @@ -3,9 +3,9 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" ) func (r *CommandSide) ChangeHumanProfile(ctx context.Context, profile *domain.Profile) (*domain.Profile, error) { diff --git a/internal/v2/command/user_human_profile_model.go b/internal/command/user_human_profile_model.go similarity index 95% rename from internal/v2/command/user_human_profile_model.go rename to internal/command/user_human_profile_model.go index 17e08effe9..c48625cd01 100644 --- a/internal/v2/command/user_human_profile_model.go +++ b/internal/command/user_human_profile_model.go @@ -2,12 +2,12 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" "golang.org/x/text/language" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) type HumanProfileWriteModel struct { diff --git a/internal/v2/command/user_human_webauthn.go b/internal/command/user_human_webauthn.go similarity index 98% rename from internal/v2/command/user_human_webauthn.go rename to internal/command/user_human_webauthn.go index e0aa2c5f2f..978b3141b7 100644 --- a/internal/v2/command/user_human_webauthn.go +++ b/internal/command/user_human_webauthn.go @@ -2,12 +2,12 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" + usr_repo "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - usr_repo "github.com/caos/zitadel/internal/v2/repository/user" ) func (r *CommandSide) getHumanU2FTokens(ctx context.Context, userID, resourceowner string) ([]*domain.WebAuthNToken, error) { diff --git a/internal/v2/command/user_human_webauthn_model.go b/internal/command/user_human_webauthn_model.go similarity index 98% rename from internal/v2/command/user_human_webauthn_model.go rename to internal/command/user_human_webauthn_model.go index 2874c6ad9c..3a4b8fe269 100644 --- a/internal/v2/command/user_human_webauthn_model.go +++ b/internal/command/user_human_webauthn_model.go @@ -1,9 +1,9 @@ package command import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/user" ) type HumanWebAuthNWriteModel struct { diff --git a/internal/v2/command/user_machine.go b/internal/command/user_machine.go similarity index 96% rename from internal/v2/command/user_machine.go rename to internal/command/user_machine.go index 70fb865b16..1ab531305c 100644 --- a/internal/v2/command/user_machine.go +++ b/internal/command/user_machine.go @@ -3,10 +3,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" ) func (r *CommandSide) AddMachine(ctx context.Context, orgID string, machine *domain.Machine) (*domain.Machine, error) { diff --git a/internal/v2/command/user_machine_key.go b/internal/command/user_machine_key.go similarity index 95% rename from internal/v2/command/user_machine_key.go rename to internal/command/user_machine_key.go index acb056fd9b..7b4a83fad1 100644 --- a/internal/v2/command/user_machine_key.go +++ b/internal/command/user_machine_key.go @@ -3,10 +3,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/telemetry/tracing" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" ) func (r *CommandSide) AddUserMachineKey(ctx context.Context, machineKey *domain.MachineKey, resourceOwner string) (*domain.MachineKey, error) { diff --git a/internal/v2/command/user_machine_key_model.go b/internal/command/user_machine_key_model.go similarity index 93% rename from internal/v2/command/user_machine_key_model.go rename to internal/command/user_machine_key_model.go index bcef6dd4bc..286b038f06 100644 --- a/internal/v2/command/user_machine_key_model.go +++ b/internal/command/user_machine_key_model.go @@ -1,11 +1,11 @@ package command import ( + "github.com/caos/zitadel/internal/eventstore" "time" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) type MachineKeyWriteModel struct { diff --git a/internal/v2/command/user_machine_model.go b/internal/command/user_machine_model.go similarity index 92% rename from internal/v2/command/user_machine_model.go rename to internal/command/user_machine_model.go index 3a64db0724..6ed5b96a2c 100644 --- a/internal/v2/command/user_machine_model.go +++ b/internal/command/user_machine_model.go @@ -2,10 +2,10 @@ package command import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/repository/user" ) type MachineWriteModel struct { @@ -27,7 +27,6 @@ func NewMachineWriteModel(userID, resourceOwner string) *MachineWriteModel { } } -//TODO: Compute OTPState? initial/active func (wm *MachineWriteModel) Reduce() error { for _, event := range wm.Events { switch e := event.(type) { diff --git a/internal/v2/command/user_model.go b/internal/command/user_model.go similarity index 94% rename from internal/v2/command/user_model.go rename to internal/command/user_model.go index 1da601b5cd..5fd06a9e83 100644 --- a/internal/v2/command/user_model.go +++ b/internal/command/user_model.go @@ -1,12 +1,12 @@ package command import ( + "github.com/caos/zitadel/internal/eventstore" "strings" + "github.com/caos/zitadel/internal/domain" caos_errors "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/repository/user" ) type UserWriteModel struct { @@ -25,7 +25,6 @@ func NewUserWriteModel(userID, resourceOwner string) *UserWriteModel { } } -//TODO: Compute OTPState? initial/active func (wm *UserWriteModel) Reduce() error { for _, event := range wm.Events { switch e := event.(type) { diff --git a/internal/v2/domain/application.go b/internal/domain/application.go similarity index 100% rename from internal/v2/domain/application.go rename to internal/domain/application.go diff --git a/internal/v2/domain/application_api.go b/internal/domain/application_api.go similarity index 95% rename from internal/v2/domain/application_api.go rename to internal/domain/application_api.go index 76446d58d6..161a99c176 100644 --- a/internal/v2/domain/application_api.go +++ b/internal/domain/application_api.go @@ -2,7 +2,7 @@ package domain import ( "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type APIApp struct { diff --git a/internal/v2/domain/application_key.go b/internal/domain/application_key.go similarity index 95% rename from internal/v2/domain/application_key.go rename to internal/domain/application_key.go index e199483a5e..52e8ff3c6b 100644 --- a/internal/v2/domain/application_key.go +++ b/internal/domain/application_key.go @@ -5,7 +5,7 @@ import ( "time" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type ApplicationKey struct { diff --git a/internal/v2/domain/application_oauth.go b/internal/domain/application_oauth.go similarity index 100% rename from internal/v2/domain/application_oauth.go rename to internal/domain/application_oauth.go diff --git a/internal/v2/domain/application_oidc.go b/internal/domain/application_oidc.go similarity index 99% rename from internal/v2/domain/application_oidc.go rename to internal/domain/application_oidc.go index ce5f4d3aca..0ffa05c7dd 100644 --- a/internal/v2/domain/application_oidc.go +++ b/internal/domain/application_oidc.go @@ -5,7 +5,7 @@ import ( "time" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) const ( diff --git a/internal/v2/domain/auth_request.go b/internal/domain/auth_request.go similarity index 100% rename from internal/v2/domain/auth_request.go rename to internal/domain/auth_request.go diff --git a/internal/v2/domain/authn_key.go b/internal/domain/authn_key.go similarity index 100% rename from internal/v2/domain/authn_key.go rename to internal/domain/authn_key.go diff --git a/internal/v2/domain/browser_info.go b/internal/domain/browser_info.go similarity index 100% rename from internal/v2/domain/browser_info.go rename to internal/domain/browser_info.go diff --git a/internal/v2/domain/factors.go b/internal/domain/factors.go similarity index 100% rename from internal/v2/domain/factors.go rename to internal/domain/factors.go diff --git a/internal/v2/domain/human.go b/internal/domain/human.go similarity index 97% rename from internal/v2/domain/human.go rename to internal/domain/human.go index f2568b287c..27a63a3d88 100644 --- a/internal/v2/domain/human.go +++ b/internal/domain/human.go @@ -3,7 +3,7 @@ package domain import ( "github.com/caos/zitadel/internal/crypto" caos_errors "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "strings" "time" ) diff --git a/internal/v2/domain/human_address.go b/internal/domain/human_address.go similarity index 84% rename from internal/v2/domain/human_address.go rename to internal/domain/human_address.go index 1b89a26e2e..b67494a495 100644 --- a/internal/v2/domain/human_address.go +++ b/internal/domain/human_address.go @@ -1,6 +1,6 @@ package domain -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type Address struct { es_models.ObjectRoot diff --git a/internal/v2/domain/human_email.go b/internal/domain/human_email.go similarity index 89% rename from internal/v2/domain/human_email.go rename to internal/domain/human_email.go index c27e2e37c7..bd0a55a4c3 100644 --- a/internal/v2/domain/human_email.go +++ b/internal/domain/human_email.go @@ -2,7 +2,7 @@ package domain import ( "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "time" ) diff --git a/internal/v2/domain/human_external_idp.go b/internal/domain/human_external_idp.go similarity index 87% rename from internal/v2/domain/human_external_idp.go rename to internal/domain/human_external_idp.go index ad9433959e..839453a5dc 100644 --- a/internal/v2/domain/human_external_idp.go +++ b/internal/domain/human_external_idp.go @@ -1,6 +1,6 @@ package domain -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type ExternalIDP struct { es_models.ObjectRoot diff --git a/internal/v2/domain/human_otp.go b/internal/domain/human_otp.go similarity index 94% rename from internal/v2/domain/human_otp.go rename to internal/domain/human_otp.go index 06840e8266..cf715c7029 100644 --- a/internal/v2/domain/human_otp.go +++ b/internal/domain/human_otp.go @@ -3,7 +3,7 @@ package domain import ( "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/pquerna/otp" "github.com/pquerna/otp/totp" ) diff --git a/internal/v2/domain/human_password.go b/internal/domain/human_password.go similarity index 95% rename from internal/v2/domain/human_password.go rename to internal/domain/human_password.go index 275e7a943a..732344a5a8 100644 --- a/internal/v2/domain/human_password.go +++ b/internal/domain/human_password.go @@ -3,7 +3,7 @@ package domain import ( "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "time" ) diff --git a/internal/v2/domain/human_phone.go b/internal/domain/human_phone.go similarity index 94% rename from internal/v2/domain/human_phone.go rename to internal/domain/human_phone.go index 123472d73b..7b0cd3a9af 100644 --- a/internal/v2/domain/human_phone.go +++ b/internal/domain/human_phone.go @@ -3,7 +3,7 @@ package domain import ( "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/ttacon/libphonenumber" "time" ) diff --git a/internal/v2/domain/human_profile.go b/internal/domain/human_profile.go similarity index 86% rename from internal/v2/domain/human_profile.go rename to internal/domain/human_profile.go index 71442c3ab1..ab0989b37e 100644 --- a/internal/v2/domain/human_profile.go +++ b/internal/domain/human_profile.go @@ -1,7 +1,7 @@ package domain import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "golang.org/x/text/language" ) diff --git a/internal/v2/domain/human_web_auth_n.go b/internal/domain/human_web_auth_n.go similarity index 95% rename from internal/v2/domain/human_web_auth_n.go rename to internal/domain/human_web_auth_n.go index 225b87ac4e..96c6a293da 100644 --- a/internal/v2/domain/human_web_auth_n.go +++ b/internal/domain/human_web_auth_n.go @@ -2,7 +2,7 @@ package domain import ( "bytes" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type WebAuthNToken struct { diff --git a/internal/v2/domain/iam.go b/internal/domain/iam.go similarity index 91% rename from internal/v2/domain/iam.go rename to internal/domain/iam.go index fbb7f49101..e8ba8a029c 100644 --- a/internal/v2/domain/iam.go +++ b/internal/domain/iam.go @@ -1,7 +1,7 @@ package domain import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) const ( diff --git a/internal/v2/domain/idp_config.go b/internal/domain/idp_config.go similarity index 96% rename from internal/v2/domain/idp_config.go rename to internal/domain/idp_config.go index 092f8efeae..8ef8084c60 100644 --- a/internal/v2/domain/idp_config.go +++ b/internal/domain/idp_config.go @@ -2,7 +2,7 @@ package domain import ( "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "time" ) diff --git a/internal/v2/domain/key_pair.go b/internal/domain/key_pair.go similarity index 90% rename from internal/v2/domain/key_pair.go rename to internal/domain/key_pair.go index 8215734a1a..cafd2072b8 100644 --- a/internal/v2/domain/key_pair.go +++ b/internal/domain/key_pair.go @@ -2,7 +2,7 @@ package domain import ( "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "time" ) diff --git a/internal/v2/domain/machine.go b/internal/domain/machine.go similarity index 83% rename from internal/v2/domain/machine.go rename to internal/domain/machine.go index dad9e0ef36..519061530c 100644 --- a/internal/v2/domain/machine.go +++ b/internal/domain/machine.go @@ -1,6 +1,6 @@ package domain -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" type Machine struct { models.ObjectRoot diff --git a/internal/v2/domain/machine_key.go b/internal/domain/machine_key.go similarity index 93% rename from internal/v2/domain/machine_key.go rename to internal/domain/machine_key.go index e29803aac3..e0dbdf4c37 100644 --- a/internal/v2/domain/machine_key.go +++ b/internal/domain/machine_key.go @@ -3,7 +3,7 @@ package domain import ( "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type MachineKey struct { diff --git a/internal/v2/domain/member.go b/internal/domain/member.go similarity index 90% rename from internal/v2/domain/member.go rename to internal/domain/member.go index d58402daec..54e954e40a 100644 --- a/internal/v2/domain/member.go +++ b/internal/domain/member.go @@ -1,7 +1,7 @@ package domain import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Member struct { diff --git a/internal/v2/domain/mfa.go b/internal/domain/mfa.go similarity index 100% rename from internal/v2/domain/mfa.go rename to internal/domain/mfa.go diff --git a/internal/v2/domain/next_step.go b/internal/domain/next_step.go similarity index 100% rename from internal/v2/domain/next_step.go rename to internal/domain/next_step.go diff --git a/internal/v2/domain/notification.go b/internal/domain/notification.go similarity index 100% rename from internal/v2/domain/notification.go rename to internal/domain/notification.go diff --git a/internal/v2/domain/oidc_code_challenge.go b/internal/domain/oidc_code_challenge.go similarity index 100% rename from internal/v2/domain/oidc_code_challenge.go rename to internal/domain/oidc_code_challenge.go diff --git a/internal/v2/domain/oidc_mapping_field.go b/internal/domain/oidc_mapping_field.go similarity index 100% rename from internal/v2/domain/oidc_mapping_field.go rename to internal/domain/oidc_mapping_field.go diff --git a/internal/v2/domain/org.go b/internal/domain/org.go similarity index 94% rename from internal/v2/domain/org.go rename to internal/domain/org.go index 52d303272a..c3eeaef91f 100644 --- a/internal/v2/domain/org.go +++ b/internal/domain/org.go @@ -3,7 +3,7 @@ package domain import ( "strings" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Org struct { diff --git a/internal/v2/domain/org_domain.go b/internal/domain/org_domain.go similarity index 96% rename from internal/v2/domain/org_domain.go rename to internal/domain/org_domain.go index 7b2ffd6fe8..bc85388563 100644 --- a/internal/v2/domain/org_domain.go +++ b/internal/domain/org_domain.go @@ -3,7 +3,7 @@ package domain import ( http_util "github.com/caos/zitadel/internal/api/http" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type OrgDomain struct { diff --git a/internal/v2/domain/policy.go b/internal/domain/policy.go similarity index 100% rename from internal/v2/domain/policy.go rename to internal/domain/policy.go diff --git a/internal/v2/domain/policy_label.go b/internal/domain/policy_label.go similarity index 71% rename from internal/v2/domain/policy_label.go rename to internal/domain/policy_label.go index 53548acf47..591d6d37d3 100644 --- a/internal/v2/domain/policy_label.go +++ b/internal/domain/policy_label.go @@ -1,7 +1,7 @@ package domain import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type LabelPolicy struct { diff --git a/internal/v2/domain/policy_login.go b/internal/domain/policy_login.go similarity index 93% rename from internal/v2/domain/policy_login.go rename to internal/domain/policy_login.go index 14f8b65a13..6cf5e989d6 100644 --- a/internal/v2/domain/policy_login.go +++ b/internal/domain/policy_login.go @@ -1,6 +1,6 @@ package domain -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" type LoginPolicy struct { models.ObjectRoot diff --git a/internal/v2/domain/policy_mail_template.go b/internal/domain/policy_mail_template.go similarity index 75% rename from internal/v2/domain/policy_mail_template.go rename to internal/domain/policy_mail_template.go index be205cede3..5d307d8460 100644 --- a/internal/v2/domain/policy_mail_template.go +++ b/internal/domain/policy_mail_template.go @@ -1,6 +1,6 @@ package domain -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" type MailTemplate struct { models.ObjectRoot diff --git a/internal/v2/domain/policy_mail_text.go b/internal/domain/policy_mail_text.go similarity index 88% rename from internal/v2/domain/policy_mail_text.go rename to internal/domain/policy_mail_text.go index 35a1950549..ce1e4b12b1 100644 --- a/internal/v2/domain/policy_mail_text.go +++ b/internal/domain/policy_mail_text.go @@ -1,6 +1,6 @@ package domain -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" type MailText struct { models.ObjectRoot diff --git a/internal/v2/domain/policy_org_iam.go b/internal/domain/policy_org_iam.go similarity index 70% rename from internal/v2/domain/policy_org_iam.go rename to internal/domain/policy_org_iam.go index bcde9ec26d..47d575a501 100644 --- a/internal/v2/domain/policy_org_iam.go +++ b/internal/domain/policy_org_iam.go @@ -1,7 +1,7 @@ package domain import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type OrgIAMPolicy struct { diff --git a/internal/v2/domain/policy_password_age.go b/internal/domain/policy_password_age.go similarity index 69% rename from internal/v2/domain/policy_password_age.go rename to internal/domain/policy_password_age.go index 92bf8a4d7b..93c8398884 100644 --- a/internal/v2/domain/policy_password_age.go +++ b/internal/domain/policy_password_age.go @@ -1,7 +1,7 @@ package domain import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type PasswordAgePolicy struct { diff --git a/internal/v2/domain/policy_password_complexity.go b/internal/domain/policy_password_complexity.go similarity index 96% rename from internal/v2/domain/policy_password_complexity.go rename to internal/domain/policy_password_complexity.go index 318691425a..3b64b3be71 100644 --- a/internal/v2/domain/policy_password_complexity.go +++ b/internal/domain/policy_password_complexity.go @@ -2,7 +2,7 @@ package domain import ( caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "regexp" ) diff --git a/internal/v2/domain/policy_password_lockout.go b/internal/domain/policy_password_lockout.go similarity index 71% rename from internal/v2/domain/policy_password_lockout.go rename to internal/domain/policy_password_lockout.go index b6ab37746a..d46fa3973d 100644 --- a/internal/v2/domain/policy_password_lockout.go +++ b/internal/domain/policy_password_lockout.go @@ -1,7 +1,7 @@ package domain import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type PasswordLockoutPolicy struct { diff --git a/internal/v2/domain/project.go b/internal/domain/project.go similarity index 89% rename from internal/v2/domain/project.go rename to internal/domain/project.go index 8b9ce65cc3..5e35fc786b 100644 --- a/internal/v2/domain/project.go +++ b/internal/domain/project.go @@ -1,7 +1,7 @@ package domain import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Project struct { diff --git a/internal/v2/domain/project_grant.go b/internal/domain/project_grant.go similarity index 92% rename from internal/v2/domain/project_grant.go rename to internal/domain/project_grant.go index e5b61126e5..515f1e88af 100644 --- a/internal/v2/domain/project_grant.go +++ b/internal/domain/project_grant.go @@ -1,6 +1,6 @@ package domain -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type ProjectGrant struct { es_models.ObjectRoot diff --git a/internal/v2/domain/project_grant_member.go b/internal/domain/project_grant_member.go similarity index 88% rename from internal/v2/domain/project_grant_member.go rename to internal/domain/project_grant_member.go index b26e05e4ec..0a9ecef2a1 100644 --- a/internal/v2/domain/project_grant_member.go +++ b/internal/domain/project_grant_member.go @@ -1,7 +1,7 @@ package domain import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type ProjectGrantMember struct { diff --git a/internal/v2/domain/project_role.go b/internal/domain/project_role.go similarity index 89% rename from internal/v2/domain/project_role.go rename to internal/domain/project_role.go index b656be9dff..1d8b6adfff 100644 --- a/internal/v2/domain/project_role.go +++ b/internal/domain/project_role.go @@ -1,7 +1,7 @@ package domain import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type ProjectRole struct { diff --git a/internal/v2/domain/provider.go b/internal/domain/provider.go similarity index 100% rename from internal/v2/domain/provider.go rename to internal/domain/provider.go diff --git a/internal/v2/domain/request.go b/internal/domain/request.go similarity index 100% rename from internal/v2/domain/request.go rename to internal/domain/request.go diff --git a/internal/v2/domain/roles.go b/internal/domain/roles.go similarity index 100% rename from internal/v2/domain/roles.go rename to internal/domain/roles.go diff --git a/internal/v2/domain/step.go b/internal/domain/step.go similarity index 100% rename from internal/v2/domain/step.go rename to internal/domain/step.go diff --git a/internal/v2/domain/token.go b/internal/domain/token.go similarity index 89% rename from internal/v2/domain/token.go rename to internal/domain/token.go index b5d791089c..a5a560c303 100644 --- a/internal/v2/domain/token.go +++ b/internal/domain/token.go @@ -1,7 +1,7 @@ package domain import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "strings" "time" ) diff --git a/internal/v2/domain/unique_constraint_migration.go b/internal/domain/unique_constraint_migration.go similarity index 100% rename from internal/v2/domain/unique_constraint_migration.go rename to internal/domain/unique_constraint_migration.go diff --git a/internal/v2/domain/user.go b/internal/domain/user.go similarity index 100% rename from internal/v2/domain/user.go rename to internal/domain/user.go diff --git a/internal/v2/domain/user_grant.go b/internal/domain/user_grant.go similarity index 85% rename from internal/v2/domain/user_grant.go rename to internal/domain/user_grant.go index 0545ab18a1..59f84ea0a1 100644 --- a/internal/v2/domain/user_grant.go +++ b/internal/domain/user_grant.go @@ -1,6 +1,6 @@ package domain -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type UserGrant struct { es_models.ObjectRoot diff --git a/internal/eventstore/v2/aggregate.go b/internal/eventstore/aggregate.go similarity index 100% rename from internal/eventstore/v2/aggregate.go rename to internal/eventstore/aggregate.go diff --git a/internal/eventstore/v2/event.go b/internal/eventstore/event.go similarity index 100% rename from internal/eventstore/v2/event.go rename to internal/eventstore/event.go diff --git a/internal/eventstore/v2/event_base.go b/internal/eventstore/event_base.go similarity index 97% rename from internal/eventstore/v2/event_base.go rename to internal/eventstore/event_base.go index 9f9980e68a..cc771a89b7 100644 --- a/internal/eventstore/v2/event_base.go +++ b/internal/eventstore/event_base.go @@ -6,7 +6,7 @@ import ( "github.com/caos/zitadel/internal/api/authz" "github.com/caos/zitadel/internal/api/service" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) //BaseEvent represents the minimum metadata of an event diff --git a/internal/eventstore/eventstore.go b/internal/eventstore/eventstore.go index 84665dfc77..2a6c9c3256 100644 --- a/internal/eventstore/eventstore.go +++ b/internal/eventstore/eventstore.go @@ -2,74 +2,223 @@ package eventstore import ( "context" + "encoding/json" + "reflect" + "sync" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/internal/repository" - "github.com/caos/zitadel/internal/eventstore/models" - es_v2 "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore/repository" ) -type Eventstore interface { - AggregateCreator() *models.AggregateCreator - Health(ctx context.Context) error - PushAggregates(ctx context.Context, aggregates ...*models.Aggregate) error - FilterEvents(ctx context.Context, searchQuery *models.SearchQuery) (events []*models.Event, err error) - LatestSequence(ctx context.Context, searchQuery *models.SearchQueryFactory) (uint64, error) - V2() *es_v2.Eventstore - Subscribe(aggregates ...models.AggregateType) *Subscription +//Eventstore abstracts all functions needed to store valid events +// and filters the stored events +type Eventstore struct { + repo repository.Repository + interceptorMutex sync.Mutex + eventInterceptors map[EventType]eventTypeInterceptors } -var _ Eventstore = (*eventstore)(nil) - -type eventstore struct { - repo repository.Repository - aggregateCreator *models.AggregateCreator - - esV2 *es_v2.Eventstore +type eventTypeInterceptors struct { + eventMapper func(*repository.Event) (EventReader, error) } -func (es *eventstore) AggregateCreator() *models.AggregateCreator { - return es.aggregateCreator +func NewEventstore(repo repository.Repository) *Eventstore { + return &Eventstore{ + repo: repo, + eventInterceptors: map[EventType]eventTypeInterceptors{}, + interceptorMutex: sync.Mutex{}, + } } -func (es *eventstore) PushAggregates(ctx context.Context, aggregates ...*models.Aggregate) (err error) { - for _, aggregate := range aggregates { - if len(aggregate.Events) == 0 { - return errors.ThrowInvalidArgument(nil, "EVENT-cNhIj", "no events in aggregate") +//Health checks if the eventstore can properly work +// It checks if the repository can serve load +func (es *Eventstore) Health(ctx context.Context) error { + return es.repo.Health(ctx) +} + +//PushEvents pushes the events in a single transaction +// an event needs at least an aggregate +func (es *Eventstore) PushEvents(ctx context.Context, pushEvents ...EventPusher) ([]EventReader, error) { + events, constraints, err := eventsToRepository(pushEvents) + if err != nil { + return nil, err + } + err = es.repo.Push(ctx, events, constraints...) + if err != nil { + return nil, err + } + return es.mapEvents(events) +} + +func eventsToRepository(pushEvents []EventPusher) (events []*repository.Event, constraints []*repository.UniqueConstraint, err error) { + events = make([]*repository.Event, len(pushEvents)) + for i, event := range pushEvents { + data, err := eventData(event) + if err != nil { + return nil, nil, err } - for _, event := range aggregate.Events { - if err = event.Validate(); err != nil { - return errors.ThrowInvalidArgument(err, "EVENT-tzIhl", "validate event failed") - } + events[i] = &repository.Event{ + AggregateID: event.Aggregate().ID, + AggregateType: repository.AggregateType(event.Aggregate().Typ), + ResourceOwner: event.Aggregate().ResourceOwner, + EditorService: event.EditorService(), + EditorUser: event.EditorUser(), + Type: repository.EventType(event.Type()), + Version: repository.Version(event.Aggregate().Version), + Data: data, + } + if len(event.UniqueConstraints()) > 0 { + constraints = append(constraints, uniqueConstraintsToRepository(event.UniqueConstraints())...) } } - err = es.repo.PushAggregates(ctx, aggregates...) + + return events, constraints, nil +} + +func uniqueConstraintsToRepository(constraints []*EventUniqueConstraint) (uniqueConstraints []*repository.UniqueConstraint) { + uniqueConstraints = make([]*repository.UniqueConstraint, len(constraints)) + for i, constraint := range constraints { + uniqueConstraints[i] = &repository.UniqueConstraint{ + UniqueType: constraint.UniqueType, + UniqueField: constraint.UniqueField, + Action: uniqueConstraintActionToRepository(constraint.Action), + ErrorMessage: constraint.ErrorMessage, + } + } + return uniqueConstraints +} + +//FilterEvents filters the stored events based on the searchQuery +// and maps the events to the defined event structs +func (es *Eventstore) FilterEvents(ctx context.Context, queryFactory *SearchQueryBuilder) ([]EventReader, error) { + query, err := queryFactory.build() + if err != nil { + return nil, err + } + events, err := es.repo.Filter(ctx, query) + if err != nil { + return nil, err + } + + return es.mapEvents(events) +} + +func (es *Eventstore) mapEvents(events []*repository.Event) (mappedEvents []EventReader, err error) { + mappedEvents = make([]EventReader, len(events)) + + es.interceptorMutex.Lock() + defer es.interceptorMutex.Unlock() + + for i, event := range events { + interceptors, ok := es.eventInterceptors[EventType(event.Type)] + if !ok || interceptors.eventMapper == nil { + mappedEvents[i] = BaseEventFromRepo(event) + //TODO: return error if unable to map event + continue + // return nil, errors.ThrowPreconditionFailed(nil, "V2-usujB", "event mapper not defined") + } + mappedEvents[i], err = interceptors.eventMapper(event) + if err != nil { + return nil, err + } + } + + return mappedEvents, nil +} + +type reducer interface { + //Reduce handles the events of the internal events list + // it only appends the newly added events + Reduce() error + //AppendEvents appends the passed events to an internal list of events + AppendEvents(...EventReader) +} + +//FilterToReducer filters the events based on the search query, appends all events to the reducer and calls it's reduce function +func (es *Eventstore) FilterToReducer(ctx context.Context, searchQuery *SearchQueryBuilder, r reducer) error { + events, err := es.FilterEvents(ctx, searchQuery) if err != nil { return err } - go notify(aggregates) - return nil + r.AppendEvents(events...) + + return r.Reduce() } -func (es *eventstore) FilterEvents(ctx context.Context, searchQuery *models.SearchQuery) ([]*models.Event, error) { - if err := searchQuery.Validate(); err != nil { - return nil, err +//LatestSequence filters the latest sequence for the given search query +func (es *Eventstore) LatestSequence(ctx context.Context, queryFactory *SearchQueryBuilder) (uint64, error) { + query, err := queryFactory.build() + if err != nil { + return 0, err } - return es.repo.Filter(ctx, models.FactoryFromSearchQuery(searchQuery)) + return es.repo.LatestSequence(ctx, query) } -func (es *eventstore) LatestSequence(ctx context.Context, queryFactory *models.SearchQueryFactory) (uint64, error) { - sequenceFactory := *queryFactory - sequenceFactory = *(&sequenceFactory).Columns(models.Columns_Max_Sequence) - sequenceFactory = *(&sequenceFactory).SequenceGreater(0) - return es.repo.LatestSequence(ctx, &sequenceFactory) +type queryReducer interface { + reducer + //Query returns the SearchQueryFactory for the events needed in reducer + Query() *SearchQueryBuilder } -func (es *eventstore) Health(ctx context.Context) error { - return es.repo.Health(ctx) +//FilterToQueryReducer filters the events based on the search query of the query function, +// appends all events to the reducer and calls it's reduce function +func (es *Eventstore) FilterToQueryReducer(ctx context.Context, r queryReducer) error { + events, err := es.FilterEvents(ctx, r.Query()) + if err != nil { + return err + } + r.AppendEvents(events...) + + return r.Reduce() } -func (es *eventstore) V2() *es_v2.Eventstore { - return es.esV2 +//RegisterFilterEventMapper registers a function for mapping an eventstore event to an event +func (es *Eventstore) RegisterFilterEventMapper(eventType EventType, mapper func(*repository.Event) (EventReader, error)) *Eventstore { + if mapper == nil || eventType == "" { + return es + } + es.interceptorMutex.Lock() + defer es.interceptorMutex.Unlock() + + interceptor := es.eventInterceptors[eventType] + interceptor.eventMapper = mapper + es.eventInterceptors[eventType] = interceptor + + return es +} + +func eventData(event EventPusher) ([]byte, error) { + switch data := event.Data().(type) { + case nil: + return nil, nil + case []byte: + if json.Valid(data) { + return data, nil + } + return nil, errors.ThrowInvalidArgument(nil, "V2-6SbbS", "data bytes are not json") + } + dataType := reflect.TypeOf(event.Data()) + if dataType.Kind() == reflect.Ptr { + dataType = dataType.Elem() + } + if dataType.Kind() == reflect.Struct { + dataBytes, err := json.Marshal(event.Data()) + if err != nil { + return nil, errors.ThrowInvalidArgument(err, "V2-xG87M", "could not marshal data") + } + return dataBytes, nil + } + return nil, errors.ThrowInvalidArgument(nil, "V2-91NRm", "wrong type of event data") +} + +func uniqueConstraintActionToRepository(action UniqueConstraintAction) repository.UniqueConstraintAction { + switch action { + case UniqueConstraintAdd: + return repository.UniqueConstraintAdd + case UniqueConstraintRemove: + return repository.UniqueConstraintRemoved + default: + return repository.UniqueConstraintAdd + } } diff --git a/internal/eventstore/v2/eventstore_test.go b/internal/eventstore/eventstore_test.go similarity index 99% rename from internal/eventstore/v2/eventstore_test.go rename to internal/eventstore/eventstore_test.go index c0d7aca8eb..cb11c3874b 100644 --- a/internal/eventstore/v2/eventstore_test.go +++ b/internal/eventstore/eventstore_test.go @@ -10,7 +10,7 @@ import ( "github.com/caos/zitadel/internal/api/authz" "github.com/caos/zitadel/internal/api/service" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) type testAggregate struct { diff --git a/internal/eventstore/v2/example_test.go b/internal/eventstore/example_test.go similarity index 97% rename from internal/eventstore/v2/example_test.go rename to internal/eventstore/example_test.go index a89c297b00..0fba62ec94 100644 --- a/internal/eventstore/v2/example_test.go +++ b/internal/eventstore/example_test.go @@ -4,13 +4,13 @@ import ( "context" "encoding/json" "fmt" + "github.com/caos/zitadel/internal/eventstore" "testing" "time" "github.com/caos/zitadel/internal/api/authz" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/eventstore/v2/repository/sql" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/eventstore/repository/sql" ) // ------------------------------------------------------------ @@ -30,7 +30,7 @@ func NewUserAggregate(id string) *eventstore.Aggregate { // ------------------------------------------------------------ type UserAddedEvent struct { - eventstore.BaseEvent `json:"-"` + eventstore.eventstore `json:"-"` FirstName string `json:"firstName"` } diff --git a/internal/eventstore/v2/local_crdb_test.go b/internal/eventstore/local_crdb_test.go similarity index 100% rename from internal/eventstore/v2/local_crdb_test.go rename to internal/eventstore/local_crdb_test.go diff --git a/internal/eventstore/v2/playground/show_case_test.go b/internal/eventstore/playground/show_case_test.go similarity index 100% rename from internal/eventstore/v2/playground/show_case_test.go rename to internal/eventstore/playground/show_case_test.go diff --git a/internal/eventstore/v2/read_model.go b/internal/eventstore/read_model.go similarity index 100% rename from internal/eventstore/v2/read_model.go rename to internal/eventstore/read_model.go diff --git a/internal/eventstore/v2/repository/event.go b/internal/eventstore/repository/event.go similarity index 100% rename from internal/eventstore/v2/repository/event.go rename to internal/eventstore/repository/event.go diff --git a/internal/eventstore/v2/repository/repository.go b/internal/eventstore/repository/repository.go similarity index 100% rename from internal/eventstore/v2/repository/repository.go rename to internal/eventstore/repository/repository.go diff --git a/internal/eventstore/v2/repository/search_query.go b/internal/eventstore/repository/search_query.go similarity index 100% rename from internal/eventstore/v2/repository/search_query.go rename to internal/eventstore/repository/search_query.go diff --git a/internal/eventstore/v2/repository/search_query_test.go b/internal/eventstore/repository/search_query_test.go similarity index 100% rename from internal/eventstore/v2/repository/search_query_test.go rename to internal/eventstore/repository/search_query_test.go diff --git a/internal/eventstore/v2/repository/sql/crdb.go b/internal/eventstore/repository/sql/crdb.go similarity index 99% rename from internal/eventstore/v2/repository/sql/crdb.go rename to internal/eventstore/repository/sql/crdb.go index e9ad16a231..4bed38de32 100644 --- a/internal/eventstore/v2/repository/sql/crdb.go +++ b/internal/eventstore/repository/sql/crdb.go @@ -10,7 +10,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" "github.com/cockroachdb/cockroach-go/v2/crdb" //sql import for cockroach diff --git a/internal/eventstore/v2/repository/sql/crdb_test.go b/internal/eventstore/repository/sql/crdb_test.go similarity index 99% rename from internal/eventstore/v2/repository/sql/crdb_test.go rename to internal/eventstore/repository/sql/crdb_test.go index bccdca3fef..3c67813a8d 100644 --- a/internal/eventstore/v2/repository/sql/crdb_test.go +++ b/internal/eventstore/repository/sql/crdb_test.go @@ -5,7 +5,7 @@ import ( "sync" "testing" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" "github.com/lib/pq" _ "github.com/lib/pq" ) diff --git a/internal/eventstore/v2/repository/sql/local_crdb_test.go b/internal/eventstore/repository/sql/local_crdb_test.go similarity index 100% rename from internal/eventstore/v2/repository/sql/local_crdb_test.go rename to internal/eventstore/repository/sql/local_crdb_test.go diff --git a/internal/eventstore/v2/repository/sql/query.go b/internal/eventstore/repository/sql/query.go similarity index 98% rename from internal/eventstore/v2/repository/sql/query.go rename to internal/eventstore/repository/sql/query.go index a3a351a9aa..ca9120d4e3 100644 --- a/internal/eventstore/v2/repository/sql/query.go +++ b/internal/eventstore/repository/sql/query.go @@ -11,7 +11,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" z_errors "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" "github.com/lib/pq" ) diff --git a/internal/eventstore/v2/repository/sql/query_test.go b/internal/eventstore/repository/sql/query_test.go similarity index 99% rename from internal/eventstore/v2/repository/sql/query_test.go rename to internal/eventstore/repository/sql/query_test.go index 46fe6efdb3..0a8f72f567 100644 --- a/internal/eventstore/v2/repository/sql/query_test.go +++ b/internal/eventstore/repository/sql/query_test.go @@ -10,7 +10,7 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" "github.com/lib/pq" ) diff --git a/internal/eventstore/v2/repository/sql/types.go b/internal/eventstore/repository/sql/types.go similarity index 100% rename from internal/eventstore/v2/repository/sql/types.go rename to internal/eventstore/repository/sql/types.go diff --git a/internal/eventstore/v2/repository/unique_constraint.go b/internal/eventstore/repository/unique_constraint.go similarity index 100% rename from internal/eventstore/v2/repository/unique_constraint.go rename to internal/eventstore/repository/unique_constraint.go diff --git a/internal/eventstore/v2/repository/version.go b/internal/eventstore/repository/version.go similarity index 100% rename from internal/eventstore/v2/repository/version.go rename to internal/eventstore/repository/version.go diff --git a/internal/eventstore/v2/repository/version_test.go b/internal/eventstore/repository/version_test.go similarity index 100% rename from internal/eventstore/v2/repository/version_test.go rename to internal/eventstore/repository/version_test.go diff --git a/internal/eventstore/v2/search_query.go b/internal/eventstore/search_query.go similarity index 98% rename from internal/eventstore/v2/search_query.go rename to internal/eventstore/search_query.go index 9acf0e3092..94d5e2f05c 100644 --- a/internal/eventstore/v2/search_query.go +++ b/internal/eventstore/search_query.go @@ -2,7 +2,7 @@ package eventstore import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) //SearchQueryBuilder represents the builder for your filter diff --git a/internal/eventstore/v2/search_query_test.go b/internal/eventstore/search_query_test.go similarity index 99% rename from internal/eventstore/v2/search_query_test.go rename to internal/eventstore/search_query_test.go index 9b5b90e252..88d425da38 100644 --- a/internal/eventstore/v2/search_query_test.go +++ b/internal/eventstore/search_query_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) func testSetColumns(columns Columns) func(factory *SearchQueryBuilder) *SearchQueryBuilder { diff --git a/internal/eventstore/v2/unique_constraint.go b/internal/eventstore/unique_constraint.go similarity index 100% rename from internal/eventstore/v2/unique_constraint.go rename to internal/eventstore/unique_constraint.go diff --git a/internal/eventstore/config.go b/internal/eventstore/v1/config.go similarity index 55% rename from internal/eventstore/config.go rename to internal/eventstore/v1/config.go index 51bb6bfe01..2bce476a85 100644 --- a/internal/eventstore/config.go +++ b/internal/eventstore/v1/config.go @@ -1,11 +1,11 @@ -package eventstore +package v1 import ( "github.com/caos/zitadel/internal/cache/config" - "github.com/caos/zitadel/internal/eventstore/internal/repository/sql" - "github.com/caos/zitadel/internal/eventstore/models" - es_v2 "github.com/caos/zitadel/internal/eventstore/v2" - sql_v2 "github.com/caos/zitadel/internal/eventstore/v2/repository/sql" + eventstore2 "github.com/caos/zitadel/internal/eventstore" + sql_v2 "github.com/caos/zitadel/internal/eventstore/repository/sql" + "github.com/caos/zitadel/internal/eventstore/v1/internal/repository/sql" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Config struct { @@ -23,6 +23,6 @@ func Start(conf Config) (Eventstore, error) { return &eventstore{ repo: repo, aggregateCreator: models.NewAggregateCreator(conf.ServiceName), - esV2: es_v2.NewEventstore(sql_v2.NewCRDB(sqlClient)), + esV2: eventstore2.NewEventstore(sql_v2.NewCRDB(sqlClient)), }, nil } diff --git a/internal/eventstore/v1/eventstore.go b/internal/eventstore/v1/eventstore.go new file mode 100644 index 0000000000..b68ca33170 --- /dev/null +++ b/internal/eventstore/v1/eventstore.go @@ -0,0 +1,75 @@ +package v1 + +import ( + "context" + eventstore2 "github.com/caos/zitadel/internal/eventstore" + + "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/eventstore/v1/internal/repository" + "github.com/caos/zitadel/internal/eventstore/v1/models" +) + +type Eventstore interface { + AggregateCreator() *models.AggregateCreator + Health(ctx context.Context) error + PushAggregates(ctx context.Context, aggregates ...*models.Aggregate) error + FilterEvents(ctx context.Context, searchQuery *models.SearchQuery) (events []*models.Event, err error) + LatestSequence(ctx context.Context, searchQuery *models.SearchQueryFactory) (uint64, error) + V2() *eventstore2.Eventstore + Subscribe(aggregates ...models.AggregateType) *Subscription +} + +var _ Eventstore = (*eventstore)(nil) + +type eventstore struct { + repo repository.Repository + aggregateCreator *models.AggregateCreator + + esV2 *eventstore2.Eventstore +} + +func (es *eventstore) AggregateCreator() *models.AggregateCreator { + return es.aggregateCreator +} + +func (es *eventstore) PushAggregates(ctx context.Context, aggregates ...*models.Aggregate) (err error) { + for _, aggregate := range aggregates { + if len(aggregate.Events) == 0 { + return errors.ThrowInvalidArgument(nil, "EVENT-cNhIj", "no events in aggregate") + } + for _, event := range aggregate.Events { + if err = event.Validate(); err != nil { + return errors.ThrowInvalidArgument(err, "EVENT-tzIhl", "validate event failed") + } + } + } + err = es.repo.PushAggregates(ctx, aggregates...) + if err != nil { + return err + } + + go notify(aggregates) + return nil +} + +func (es *eventstore) FilterEvents(ctx context.Context, searchQuery *models.SearchQuery) ([]*models.Event, error) { + if err := searchQuery.Validate(); err != nil { + return nil, err + } + return es.repo.Filter(ctx, models.FactoryFromSearchQuery(searchQuery)) +} + +func (es *eventstore) LatestSequence(ctx context.Context, queryFactory *models.SearchQueryFactory) (uint64, error) { + sequenceFactory := *queryFactory + sequenceFactory = *(&sequenceFactory).Columns(models.Columns_Max_Sequence) + sequenceFactory = *(&sequenceFactory).SequenceGreater(0) + return es.repo.LatestSequence(ctx, &sequenceFactory) +} + +func (es *eventstore) Health(ctx context.Context) error { + return es.repo.Health(ctx) +} + +func (es *eventstore) V2() *eventstore2.Eventstore { + return es.esV2 +} diff --git a/internal/eventstore/gen_mock.go b/internal/eventstore/v1/gen_mock.go similarity index 87% rename from internal/eventstore/gen_mock.go rename to internal/eventstore/v1/gen_mock.go index aa09e2fdc3..0c958d6c8f 100644 --- a/internal/eventstore/gen_mock.go +++ b/internal/eventstore/v1/gen_mock.go @@ -1,3 +1,3 @@ -package eventstore +package v1 //go:generate mockgen -package mock -destination ./mock/eventstore.mock.go github.com/caos/zitadel/internal/eventstore Eventstore diff --git a/internal/eventstore/internal/repository/gen_mock.go b/internal/eventstore/v1/internal/repository/gen_mock.go similarity index 100% rename from internal/eventstore/internal/repository/gen_mock.go rename to internal/eventstore/v1/internal/repository/gen_mock.go diff --git a/internal/eventstore/internal/repository/mock/repository.go b/internal/eventstore/v1/internal/repository/mock/repository.go similarity index 94% rename from internal/eventstore/internal/repository/mock/repository.go rename to internal/eventstore/v1/internal/repository/mock/repository.go index f630872fc2..a07b8b8e06 100644 --- a/internal/eventstore/internal/repository/mock/repository.go +++ b/internal/eventstore/v1/internal/repository/mock/repository.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" gomock "github.com/golang/mock/gomock" ) diff --git a/internal/eventstore/internal/repository/mock/repository.mock.go b/internal/eventstore/v1/internal/repository/mock/repository.mock.go similarity index 98% rename from internal/eventstore/internal/repository/mock/repository.mock.go rename to internal/eventstore/v1/internal/repository/mock/repository.mock.go index 438fe15c6e..204c088925 100644 --- a/internal/eventstore/internal/repository/mock/repository.mock.go +++ b/internal/eventstore/v1/internal/repository/mock/repository.mock.go @@ -6,7 +6,7 @@ package mock import ( context "context" - models "github.com/caos/zitadel/internal/eventstore/models" + models "github.com/caos/zitadel/internal/eventstore/v1/models" gomock "github.com/golang/mock/gomock" reflect "reflect" ) diff --git a/internal/eventstore/internal/repository/repository.go b/internal/eventstore/v1/internal/repository/repository.go similarity index 92% rename from internal/eventstore/internal/repository/repository.go rename to internal/eventstore/v1/internal/repository/repository.go index 84a4e10f06..2acc17f6e2 100644 --- a/internal/eventstore/internal/repository/repository.go +++ b/internal/eventstore/v1/internal/repository/repository.go @@ -3,7 +3,7 @@ package repository import ( "context" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Repository interface { diff --git a/internal/eventstore/internal/repository/sql/config.go b/internal/eventstore/v1/internal/repository/sql/config.go similarity index 100% rename from internal/eventstore/internal/repository/sql/config.go rename to internal/eventstore/v1/internal/repository/sql/config.go diff --git a/internal/eventstore/internal/repository/sql/db_mock_test.go b/internal/eventstore/v1/internal/repository/sql/db_mock_test.go similarity index 99% rename from internal/eventstore/internal/repository/sql/db_mock_test.go rename to internal/eventstore/v1/internal/repository/sql/db_mock_test.go index 4fa03fb3d9..71a6387797 100644 --- a/internal/eventstore/internal/repository/sql/db_mock_test.go +++ b/internal/eventstore/v1/internal/repository/sql/db_mock_test.go @@ -7,7 +7,7 @@ import ( "time" "github.com/DATA-DOG/go-sqlmock" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) const ( diff --git a/internal/eventstore/internal/repository/sql/filter.go b/internal/eventstore/v1/internal/repository/sql/filter.go similarity index 89% rename from internal/eventstore/internal/repository/sql/filter.go rename to internal/eventstore/v1/internal/repository/sql/filter.go index e9a98939da..0b365eac77 100644 --- a/internal/eventstore/internal/repository/sql/filter.go +++ b/internal/eventstore/v1/internal/repository/sql/filter.go @@ -6,8 +6,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/telemetry/tracing" ) @@ -15,7 +14,7 @@ type Querier interface { Query(query string, args ...interface{}) (*sql.Rows, error) } -func (db *SQL) Filter(ctx context.Context, searchQuery *es_models.SearchQueryFactory) (events []*models.Event, err error) { +func (db *SQL) Filter(ctx context.Context, searchQuery *es_models.SearchQueryFactory) (events []*es_models.Event, err error) { return filter(db.client, searchQuery) } @@ -35,7 +34,7 @@ func filter(querier Querier, searchQuery *es_models.SearchQueryFactory) (events events = make([]*es_models.Event, 0, limit) for rows.Next() { - event := new(models.Event) + event := new(es_models.Event) err := rowScanner(rows.Scan, event) if err != nil { return nil, err diff --git a/internal/eventstore/internal/repository/sql/filter_test.go b/internal/eventstore/v1/internal/repository/sql/filter_test.go similarity index 98% rename from internal/eventstore/internal/repository/sql/filter_test.go rename to internal/eventstore/v1/internal/repository/sql/filter_test.go index fc8bde47c4..b831be2e5e 100644 --- a/internal/eventstore/internal/repository/sql/filter_test.go +++ b/internal/eventstore/v1/internal/repository/sql/filter_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestSQL_Filter(t *testing.T) { diff --git a/internal/eventstore/internal/repository/sql/push.go b/internal/eventstore/v1/internal/repository/sql/push.go similarity index 98% rename from internal/eventstore/internal/repository/sql/push.go rename to internal/eventstore/v1/internal/repository/sql/push.go index b99233914c..27d978a6f0 100644 --- a/internal/eventstore/internal/repository/sql/push.go +++ b/internal/eventstore/v1/internal/repository/sql/push.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/telemetry/tracing" "github.com/cockroachdb/cockroach-go/v2/crdb" ) diff --git a/internal/eventstore/internal/repository/sql/push_test.go b/internal/eventstore/v1/internal/repository/sql/push_test.go similarity index 99% rename from internal/eventstore/internal/repository/sql/push_test.go rename to internal/eventstore/v1/internal/repository/sql/push_test.go index 2164c9caa9..f2e78ba4cc 100644 --- a/internal/eventstore/internal/repository/sql/push_test.go +++ b/internal/eventstore/v1/internal/repository/sql/push_test.go @@ -9,7 +9,7 @@ import ( "testing" z_errors "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type mockEvents struct { diff --git a/internal/eventstore/internal/repository/sql/query.go b/internal/eventstore/v1/internal/repository/sql/query.go similarity index 84% rename from internal/eventstore/internal/repository/sql/query.go rename to internal/eventstore/v1/internal/repository/sql/query.go index 1a9a3750ff..e87f7a7ce0 100644 --- a/internal/eventstore/internal/repository/sql/query.go +++ b/internal/eventstore/v1/internal/repository/sql/query.go @@ -9,8 +9,7 @@ import ( "github.com/caos/logging" z_errors "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/lib/pq" ) @@ -30,7 +29,7 @@ const ( " FROM eventstore.events" ) -func buildQuery(queryFactory *models.SearchQueryFactory) (query string, limit uint64, values []interface{}, rowScanner func(s scan, dest interface{}) error) { +func buildQuery(queryFactory *es_models.SearchQueryFactory) (query string, limit uint64, values []interface{}, rowScanner func(s scan, dest interface{}) error) { searchQuery, err := queryFactory.Build() if err != nil { logging.Log("SQL-cshKu").WithError(err).Warn("search query factory invalid") @@ -43,7 +42,7 @@ func buildQuery(queryFactory *models.SearchQueryFactory) (query string, limit ui } query += where - if searchQuery.Columns != models.Columns_Max_Sequence { + if searchQuery.Columns != es_models.Columns_Max_Sequence { query += " ORDER BY event_sequence" if searchQuery.Desc { query += " DESC" @@ -60,7 +59,7 @@ func buildQuery(queryFactory *models.SearchQueryFactory) (query string, limit ui return query, searchQuery.Limit, values, rowScanner } -func prepareCondition(filters []*models.Filter) (clause string, values []interface{}) { +func prepareCondition(filters []*es_models.Filter) (clause string, values []interface{}) { values = make([]interface{}, len(filters)) clauses := make([]string, len(filters)) @@ -70,7 +69,7 @@ func prepareCondition(filters []*models.Filter) (clause string, values []interfa for i, filter := range filters { value := filter.GetValue() switch value.(type) { - case []bool, []float64, []int64, []string, []models.AggregateType, []models.EventType, *[]bool, *[]float64, *[]int64, *[]string, *[]models.AggregateType, *[]models.EventType: + case []bool, []float64, []int64, []string, []es_models.AggregateType, []es_models.EventType, *[]bool, *[]float64, *[]int64, *[]string, *[]es_models.AggregateType, *[]es_models.EventType: value = pq.Array(value) } @@ -85,9 +84,9 @@ func prepareCondition(filters []*models.Filter) (clause string, values []interfa type scan func(dest ...interface{}) error -func prepareColumns(columns models.Columns) (string, func(s scan, dest interface{}) error) { +func prepareColumns(columns es_models.Columns) (string, func(s scan, dest interface{}) error) { switch columns { - case models.Columns_Max_Sequence: + case es_models.Columns_Max_Sequence: return "SELECT MAX(event_sequence) FROM eventstore.events", func(row scan, dest interface{}) (err error) { sequence, ok := dest.(*Sequence) if !ok { @@ -99,9 +98,9 @@ func prepareColumns(columns models.Columns) (string, func(s scan, dest interface } return z_errors.ThrowInternal(err, "SQL-bN5xg", "something went wrong") } - case models.Columns_Event: + case es_models.Columns_Event: return selectStmt, func(row scan, dest interface{}) (err error) { - event, ok := dest.(*models.Event) + event, ok := dest.(*es_models.Event) if !ok { return z_errors.ThrowInvalidArgument(nil, "SQL-4GP6F", "type must be event") } diff --git a/internal/eventstore/internal/repository/sql/query_test.go b/internal/eventstore/v1/internal/repository/sql/query_test.go similarity index 95% rename from internal/eventstore/internal/repository/sql/query_test.go rename to internal/eventstore/v1/internal/repository/sql/query_test.go index c8db4ac9b4..b7016d181b 100644 --- a/internal/eventstore/internal/repository/sql/query_test.go +++ b/internal/eventstore/v1/internal/repository/sql/query_test.go @@ -7,8 +7,7 @@ import ( "time" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/lib/pq" ) @@ -182,7 +181,7 @@ func Test_getCondition(t *testing.T) { func Test_prepareColumns(t *testing.T) { type args struct { - columns models.Columns + columns es_models.Columns dest interface{} dbErr error } @@ -232,12 +231,12 @@ func Test_prepareColumns(t *testing.T) { name: "event", args: args{ columns: es_models.Columns_Event, - dest: new(models.Event), + dest: new(es_models.Event), }, res: res{ query: "SELECT creation_date, event_type, event_sequence, previous_sequence, event_data, editor_service, editor_user, resource_owner, aggregate_type, aggregate_id, aggregate_version FROM eventstore.events", - dbRow: []interface{}{time.Time{}, models.EventType(""), uint64(5), Sequence(0), Data(nil), "", "", "", models.AggregateType("user"), "hodor", models.Version("")}, - expected: models.Event{AggregateID: "hodor", AggregateType: "user", Sequence: 5, Data: make(Data, 0)}, + dbRow: []interface{}{time.Time{}, es_models.EventType(""), uint64(5), Sequence(0), Data(nil), "", "", "", es_models.AggregateType("user"), "hodor", es_models.Version("")}, + expected: es_models.Event{AggregateID: "hodor", AggregateType: "user", Sequence: 5, Data: make(Data, 0)}, }, }, { @@ -255,7 +254,7 @@ func Test_prepareColumns(t *testing.T) { name: "event query error", args: args{ columns: es_models.Columns_Event, - dest: new(models.Event), + dest: new(es_models.Event), dbErr: sql.ErrConnDone, }, res: res{ @@ -308,7 +307,7 @@ func prepareTestScan(err error, res []interface{}) scan { func Test_prepareCondition(t *testing.T) { type args struct { - filters []*models.Filter + filters []*es_models.Filter } type res struct { clause string @@ -399,7 +398,7 @@ func Test_prepareCondition(t *testing.T) { func Test_buildQuery(t *testing.T) { type args struct { - queryFactory *models.SearchQueryFactory + queryFactory *es_models.SearchQueryFactory } type res struct { query string diff --git a/internal/eventstore/internal/repository/sql/sql.go b/internal/eventstore/v1/internal/repository/sql/sql.go similarity index 100% rename from internal/eventstore/internal/repository/sql/sql.go rename to internal/eventstore/v1/internal/repository/sql/sql.go diff --git a/internal/eventstore/internal/repository/sql/types.go b/internal/eventstore/v1/internal/repository/sql/types.go similarity index 100% rename from internal/eventstore/internal/repository/sql/types.go rename to internal/eventstore/v1/internal/repository/sql/types.go diff --git a/internal/eventstore/locker/lock.go b/internal/eventstore/v1/locker/lock.go similarity index 100% rename from internal/eventstore/locker/lock.go rename to internal/eventstore/v1/locker/lock.go diff --git a/internal/eventstore/locker/lock_test.go b/internal/eventstore/v1/locker/lock_test.go similarity index 100% rename from internal/eventstore/locker/lock_test.go rename to internal/eventstore/v1/locker/lock_test.go diff --git a/internal/eventstore/mock/eventstore.mock.go b/internal/eventstore/v1/mock/eventstore.mock.go similarity index 93% rename from internal/eventstore/mock/eventstore.mock.go rename to internal/eventstore/v1/mock/eventstore.mock.go index 9a2ad52d64..fc2bbe1719 100644 --- a/internal/eventstore/mock/eventstore.mock.go +++ b/internal/eventstore/v1/mock/eventstore.mock.go @@ -6,9 +6,9 @@ package mock import ( context "context" - eventstore "github.com/caos/zitadel/internal/eventstore" - models "github.com/caos/zitadel/internal/eventstore/models" - eventstore0 "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" + models "github.com/caos/zitadel/internal/eventstore/v1/models" gomock "github.com/golang/mock/gomock" reflect "reflect" ) @@ -114,14 +114,14 @@ func (mr *MockEventstoreMockRecorder) PushAggregates(arg0 interface{}, arg1 ...i } // Subscribe mocks base method -func (m *MockEventstore) Subscribe(arg0 ...models.AggregateType) *eventstore.Subscription { +func (m *MockEventstore) Subscribe(arg0 ...models.AggregateType) *v1.Subscription { m.ctrl.T.Helper() varargs := []interface{}{} for _, a := range arg0 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Subscribe", varargs...) - ret0, _ := ret[0].(*eventstore.Subscription) + ret0, _ := ret[0].(*v1.Subscription) return ret0 } @@ -132,10 +132,10 @@ func (mr *MockEventstoreMockRecorder) Subscribe(arg0 ...interface{}) *gomock.Cal } // V2 mocks base method -func (m *MockEventstore) V2() *eventstore0.Eventstore { +func (m *MockEventstore) V2() *eventstore.Eventstore { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "V2") - ret0, _ := ret[0].(*eventstore0.Eventstore) + ret0, _ := ret[0].(*eventstore.Eventstore) return ret0 } diff --git a/internal/eventstore/models/aggregate.go b/internal/eventstore/v1/models/aggregate.go similarity index 100% rename from internal/eventstore/models/aggregate.go rename to internal/eventstore/v1/models/aggregate.go diff --git a/internal/eventstore/models/aggregate_creator.go b/internal/eventstore/v1/models/aggregate_creator.go similarity index 100% rename from internal/eventstore/models/aggregate_creator.go rename to internal/eventstore/v1/models/aggregate_creator.go diff --git a/internal/eventstore/models/aggregate_creator_test.go b/internal/eventstore/v1/models/aggregate_creator_test.go similarity index 100% rename from internal/eventstore/models/aggregate_creator_test.go rename to internal/eventstore/v1/models/aggregate_creator_test.go diff --git a/internal/eventstore/models/aggregate_test.go b/internal/eventstore/v1/models/aggregate_test.go similarity index 100% rename from internal/eventstore/models/aggregate_test.go rename to internal/eventstore/v1/models/aggregate_test.go diff --git a/internal/eventstore/models/event.go b/internal/eventstore/v1/models/event.go similarity index 100% rename from internal/eventstore/models/event.go rename to internal/eventstore/v1/models/event.go diff --git a/internal/eventstore/models/event_test.go b/internal/eventstore/v1/models/event_test.go similarity index 100% rename from internal/eventstore/models/event_test.go rename to internal/eventstore/v1/models/event_test.go diff --git a/internal/eventstore/models/field.go b/internal/eventstore/v1/models/field.go similarity index 100% rename from internal/eventstore/models/field.go rename to internal/eventstore/v1/models/field.go diff --git a/internal/eventstore/models/filter.go b/internal/eventstore/v1/models/filter.go similarity index 100% rename from internal/eventstore/models/filter.go rename to internal/eventstore/v1/models/filter.go diff --git a/internal/eventstore/models/filter_test.go b/internal/eventstore/v1/models/filter_test.go similarity index 100% rename from internal/eventstore/models/filter_test.go rename to internal/eventstore/v1/models/filter_test.go diff --git a/internal/eventstore/models/object.go b/internal/eventstore/v1/models/object.go similarity index 100% rename from internal/eventstore/models/object.go rename to internal/eventstore/v1/models/object.go diff --git a/internal/eventstore/models/object_test.go b/internal/eventstore/v1/models/object_test.go similarity index 100% rename from internal/eventstore/models/object_test.go rename to internal/eventstore/v1/models/object_test.go diff --git a/internal/eventstore/models/operation.go b/internal/eventstore/v1/models/operation.go similarity index 100% rename from internal/eventstore/models/operation.go rename to internal/eventstore/v1/models/operation.go diff --git a/internal/eventstore/models/search_query.go b/internal/eventstore/v1/models/search_query.go similarity index 100% rename from internal/eventstore/models/search_query.go rename to internal/eventstore/v1/models/search_query.go diff --git a/internal/eventstore/models/search_query_old.go b/internal/eventstore/v1/models/search_query_old.go similarity index 100% rename from internal/eventstore/models/search_query_old.go rename to internal/eventstore/v1/models/search_query_old.go diff --git a/internal/eventstore/models/search_query_old_test.go b/internal/eventstore/v1/models/search_query_old_test.go similarity index 100% rename from internal/eventstore/models/search_query_old_test.go rename to internal/eventstore/v1/models/search_query_old_test.go diff --git a/internal/eventstore/models/search_query_test.go b/internal/eventstore/v1/models/search_query_test.go similarity index 100% rename from internal/eventstore/models/search_query_test.go rename to internal/eventstore/v1/models/search_query_test.go diff --git a/internal/eventstore/models/version.go b/internal/eventstore/v1/models/version.go similarity index 100% rename from internal/eventstore/models/version.go rename to internal/eventstore/v1/models/version.go diff --git a/internal/eventstore/models/version_test.go b/internal/eventstore/v1/models/version_test.go similarity index 100% rename from internal/eventstore/models/version_test.go rename to internal/eventstore/v1/models/version_test.go diff --git a/internal/eventstore/query/handler.go b/internal/eventstore/v1/query/handler.go similarity index 93% rename from internal/eventstore/query/handler.go rename to internal/eventstore/v1/query/handler.go index 52ab1771be..a04a585289 100755 --- a/internal/eventstore/query/handler.go +++ b/internal/eventstore/v1/query/handler.go @@ -2,12 +2,12 @@ package query import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "time" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) const ( @@ -26,7 +26,7 @@ type Handler interface { AggregateTypes() []models.AggregateType CurrentSequence() (uint64, error) - Eventstore() eventstore.Eventstore + Eventstore() v1.Eventstore } func ReduceEvent(handler Handler, event *models.Event) { diff --git a/internal/eventstore/sdk/append_event_error.go b/internal/eventstore/v1/sdk/append_event_error.go similarity index 100% rename from internal/eventstore/sdk/append_event_error.go rename to internal/eventstore/v1/sdk/append_event_error.go diff --git a/internal/eventstore/sdk/append_event_error_test.go b/internal/eventstore/v1/sdk/append_event_error_test.go similarity index 100% rename from internal/eventstore/sdk/append_event_error_test.go rename to internal/eventstore/v1/sdk/append_event_error_test.go diff --git a/internal/eventstore/sdk/sdk.go b/internal/eventstore/v1/sdk/sdk.go similarity index 84% rename from internal/eventstore/sdk/sdk.go rename to internal/eventstore/v1/sdk/sdk.go index e73bc37866..9414c385a8 100644 --- a/internal/eventstore/sdk/sdk.go +++ b/internal/eventstore/v1/sdk/sdk.go @@ -4,8 +4,7 @@ import ( "context" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type filterFunc func(context.Context, *es_models.SearchQuery) ([]*es_models.Event, error) @@ -50,7 +49,7 @@ func Push(ctx context.Context, push pushFunc, appender appendFunc, aggregaters . return appendAggregates(appender, aggregates) } -func PushAggregates(ctx context.Context, push pushFunc, appender appendFunc, aggregates ...*models.Aggregate) (err error) { +func PushAggregates(ctx context.Context, push pushFunc, appender appendFunc, aggregates ...*es_models.Aggregate) (err error) { if len(aggregates) < 1 { return errors.ThrowPreconditionFailed(nil, "SDK-q9wjp", "Errors.Internal") } @@ -66,7 +65,7 @@ func PushAggregates(ctx context.Context, push pushFunc, appender appendFunc, agg return appendAggregates(appender, aggregates) } -func appendAggregates(appender appendFunc, aggregates []*models.Aggregate) error { +func appendAggregates(appender appendFunc, aggregates []*es_models.Aggregate) error { for _, aggregate := range aggregates { err := appender(aggregate.Events...) if err != nil { @@ -76,8 +75,8 @@ func appendAggregates(appender appendFunc, aggregates []*models.Aggregate) error return nil } -func makeAggregates(ctx context.Context, aggregaters []AggregateFunc) (aggregates []*models.Aggregate, err error) { - aggregates = make([]*models.Aggregate, len(aggregaters)) +func makeAggregates(ctx context.Context, aggregaters []AggregateFunc) (aggregates []*es_models.Aggregate, err error) { + aggregates = make([]*es_models.Aggregate, len(aggregaters)) for i, aggregater := range aggregaters { aggregates[i], err = aggregater(ctx) if err != nil { diff --git a/internal/eventstore/sdk/sdk_test.go b/internal/eventstore/v1/sdk/sdk_test.go similarity index 98% rename from internal/eventstore/sdk/sdk_test.go rename to internal/eventstore/v1/sdk/sdk_test.go index 25c7a577dc..9250659679 100644 --- a/internal/eventstore/sdk/sdk_test.go +++ b/internal/eventstore/v1/sdk/sdk_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestFilter(t *testing.T) { diff --git a/internal/eventstore/spooler/config.go b/internal/eventstore/v1/spooler/config.go similarity index 86% rename from internal/eventstore/spooler/config.go rename to internal/eventstore/v1/spooler/config.go index e89399b38e..9d864be695 100644 --- a/internal/eventstore/spooler/config.go +++ b/internal/eventstore/v1/spooler/config.go @@ -1,17 +1,17 @@ package spooler import ( + "github.com/caos/zitadel/internal/eventstore/v1" "math/rand" "os" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/query" + "github.com/caos/zitadel/internal/eventstore/v1/query" "github.com/caos/zitadel/internal/id" ) type Config struct { - Eventstore eventstore.Eventstore + Eventstore v1.Eventstore Locker Locker ViewHandlers []query.Handler ConcurrentWorkers int diff --git a/internal/eventstore/spooler/mock.go b/internal/eventstore/v1/spooler/mock.go similarity index 100% rename from internal/eventstore/spooler/mock.go rename to internal/eventstore/v1/spooler/mock.go diff --git a/internal/eventstore/spooler/mock/spooler.go b/internal/eventstore/v1/spooler/mock/spooler.go similarity index 100% rename from internal/eventstore/spooler/mock/spooler.go rename to internal/eventstore/v1/spooler/mock/spooler.go diff --git a/internal/eventstore/spooler/spooler.go b/internal/eventstore/v1/spooler/spooler.go similarity index 95% rename from internal/eventstore/spooler/spooler.go rename to internal/eventstore/v1/spooler/spooler.go index 40d124a6ed..b858b11221 100644 --- a/internal/eventstore/spooler/spooler.go +++ b/internal/eventstore/v1/spooler/spooler.go @@ -2,14 +2,14 @@ package spooler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "strconv" "sync" "time" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" "github.com/caos/zitadel/internal/telemetry/tracing" "github.com/caos/zitadel/internal/view/repository" ) @@ -18,7 +18,7 @@ type Spooler struct { handlers []query.Handler locker Locker lockID string - eventstore eventstore.Eventstore + eventstore v1.Eventstore workers int queue chan *spooledHandler } @@ -31,7 +31,7 @@ type spooledHandler struct { query.Handler locker Locker queuedAt time.Time - eventstore eventstore.Eventstore + eventstore v1.Eventstore } func (s *Spooler) Start() { diff --git a/internal/eventstore/spooler/spooler_test.go b/internal/eventstore/v1/spooler/spooler_test.go similarity index 96% rename from internal/eventstore/spooler/spooler_test.go rename to internal/eventstore/v1/spooler/spooler_test.go index 54ef72fb8d..eb475d93e2 100644 --- a/internal/eventstore/spooler/spooler_test.go +++ b/internal/eventstore/v1/spooler/spooler_test.go @@ -3,15 +3,15 @@ package spooler import ( "context" "fmt" - es_v2 "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" "testing" "time" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler/mock" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler/mock" "github.com/caos/zitadel/internal/view/repository" "github.com/golang/mock/gomock" ) @@ -34,7 +34,7 @@ func (h *testHandler) CurrentSequence() (uint64, error) { return 0, nil } -func (h *testHandler) Eventstore() eventstore.Eventstore { +func (h *testHandler) Eventstore() v1.Eventstore { return nil } @@ -83,7 +83,7 @@ type eventstoreStub struct { err error } -func (es *eventstoreStub) Subscribe(...models.AggregateType) *eventstore.Subscription { return nil } +func (es *eventstoreStub) Subscribe(...models.AggregateType) *v1.Subscription { return nil } func (es *eventstoreStub) Health(ctx context.Context) error { return nil @@ -106,7 +106,7 @@ func (es *eventstoreStub) PushAggregates(ctx context.Context, in ...*models.Aggr func (es *eventstoreStub) LatestSequence(ctx context.Context, in *models.SearchQueryFactory) (uint64, error) { return 0, nil } -func (es *eventstoreStub) V2() *es_v2.Eventstore { +func (es *eventstoreStub) V2() *eventstore.Eventstore { return nil } @@ -237,7 +237,7 @@ func TestSpooler_load(t *testing.T) { type fields struct { currentHandler query.Handler locker *testLocker - eventstore eventstore.Eventstore + eventstore v1.Eventstore } tests := []struct { name string diff --git a/internal/eventstore/subscription.go b/internal/eventstore/v1/subscription.go similarity index 95% rename from internal/eventstore/subscription.go rename to internal/eventstore/v1/subscription.go index 37aa0dd45c..093f47fb8f 100644 --- a/internal/eventstore/subscription.go +++ b/internal/eventstore/v1/subscription.go @@ -1,9 +1,9 @@ -package eventstore +package v1 import ( "sync" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) var ( diff --git a/internal/eventstore/v2/eventstore.go b/internal/eventstore/v2/eventstore.go deleted file mode 100644 index 501a7077cc..0000000000 --- a/internal/eventstore/v2/eventstore.go +++ /dev/null @@ -1,224 +0,0 @@ -package eventstore - -import ( - "context" - "encoding/json" - "reflect" - "sync" - - "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2/repository" -) - -//Eventstore abstracts all functions needed to store valid events -// and filters the stored events -type Eventstore struct { - repo repository.Repository - interceptorMutex sync.Mutex - eventInterceptors map[EventType]eventTypeInterceptors -} - -type eventTypeInterceptors struct { - eventMapper func(*repository.Event) (EventReader, error) -} - -func NewEventstore(repo repository.Repository) *Eventstore { - return &Eventstore{ - repo: repo, - eventInterceptors: map[EventType]eventTypeInterceptors{}, - interceptorMutex: sync.Mutex{}, - } -} - -//Health checks if the eventstore can properly work -// It checks if the repository can serve load -func (es *Eventstore) Health(ctx context.Context) error { - return es.repo.Health(ctx) -} - -//PushEvents pushes the events in a single transaction -// an event needs at least an aggregate -func (es *Eventstore) PushEvents(ctx context.Context, pushEvents ...EventPusher) ([]EventReader, error) { - events, constraints, err := eventsToRepository(pushEvents) - if err != nil { - return nil, err - } - err = es.repo.Push(ctx, events, constraints...) - if err != nil { - return nil, err - } - return es.mapEvents(events) -} - -func eventsToRepository(pushEvents []EventPusher) (events []*repository.Event, constraints []*repository.UniqueConstraint, err error) { - events = make([]*repository.Event, len(pushEvents)) - for i, event := range pushEvents { - data, err := eventData(event) - if err != nil { - return nil, nil, err - } - events[i] = &repository.Event{ - AggregateID: event.Aggregate().ID, - AggregateType: repository.AggregateType(event.Aggregate().Typ), - ResourceOwner: event.Aggregate().ResourceOwner, - EditorService: event.EditorService(), - EditorUser: event.EditorUser(), - Type: repository.EventType(event.Type()), - Version: repository.Version(event.Aggregate().Version), - Data: data, - } - if len(event.UniqueConstraints()) > 0 { - constraints = append(constraints, uniqueConstraintsToRepository(event.UniqueConstraints())...) - } - } - - return events, constraints, nil -} - -func uniqueConstraintsToRepository(constraints []*EventUniqueConstraint) (uniqueConstraints []*repository.UniqueConstraint) { - uniqueConstraints = make([]*repository.UniqueConstraint, len(constraints)) - for i, constraint := range constraints { - uniqueConstraints[i] = &repository.UniqueConstraint{ - UniqueType: constraint.UniqueType, - UniqueField: constraint.UniqueField, - Action: uniqueConstraintActionToRepository(constraint.Action), - ErrorMessage: constraint.ErrorMessage, - } - } - return uniqueConstraints -} - -//FilterEvents filters the stored events based on the searchQuery -// and maps the events to the defined event structs -func (es *Eventstore) FilterEvents(ctx context.Context, queryFactory *SearchQueryBuilder) ([]EventReader, error) { - query, err := queryFactory.build() - if err != nil { - return nil, err - } - events, err := es.repo.Filter(ctx, query) - if err != nil { - return nil, err - } - - return es.mapEvents(events) -} - -func (es *Eventstore) mapEvents(events []*repository.Event) (mappedEvents []EventReader, err error) { - mappedEvents = make([]EventReader, len(events)) - - es.interceptorMutex.Lock() - defer es.interceptorMutex.Unlock() - - for i, event := range events { - interceptors, ok := es.eventInterceptors[EventType(event.Type)] - if !ok || interceptors.eventMapper == nil { - mappedEvents[i] = BaseEventFromRepo(event) - //TODO: return error if unable to map event - continue - // return nil, errors.ThrowPreconditionFailed(nil, "V2-usujB", "event mapper not defined") - } - mappedEvents[i], err = interceptors.eventMapper(event) - if err != nil { - return nil, err - } - } - - return mappedEvents, nil -} - -type reducer interface { - //Reduce handles the events of the internal events list - // it only appends the newly added events - Reduce() error - //AppendEvents appends the passed events to an internal list of events - AppendEvents(...EventReader) -} - -//FilterToReducer filters the events based on the search query, appends all events to the reducer and calls it's reduce function -func (es *Eventstore) FilterToReducer(ctx context.Context, searchQuery *SearchQueryBuilder, r reducer) error { - events, err := es.FilterEvents(ctx, searchQuery) - if err != nil { - return err - } - - r.AppendEvents(events...) - - return r.Reduce() -} - -//LatestSequence filters the latest sequence for the given search query -func (es *Eventstore) LatestSequence(ctx context.Context, queryFactory *SearchQueryBuilder) (uint64, error) { - query, err := queryFactory.build() - if err != nil { - return 0, err - } - return es.repo.LatestSequence(ctx, query) -} - -type queryReducer interface { - reducer - //Query returns the SearchQueryFactory for the events needed in reducer - Query() *SearchQueryBuilder -} - -//FilterToQueryReducer filters the events based on the search query of the query function, -// appends all events to the reducer and calls it's reduce function -func (es *Eventstore) FilterToQueryReducer(ctx context.Context, r queryReducer) error { - events, err := es.FilterEvents(ctx, r.Query()) - if err != nil { - return err - } - r.AppendEvents(events...) - - return r.Reduce() -} - -//RegisterFilterEventMapper registers a function for mapping an eventstore event to an event -func (es *Eventstore) RegisterFilterEventMapper(eventType EventType, mapper func(*repository.Event) (EventReader, error)) *Eventstore { - if mapper == nil || eventType == "" { - return es - } - es.interceptorMutex.Lock() - defer es.interceptorMutex.Unlock() - - interceptor := es.eventInterceptors[eventType] - interceptor.eventMapper = mapper - es.eventInterceptors[eventType] = interceptor - - return es -} - -func eventData(event EventPusher) ([]byte, error) { - switch data := event.Data().(type) { - case nil: - return nil, nil - case []byte: - if json.Valid(data) { - return data, nil - } - return nil, errors.ThrowInvalidArgument(nil, "V2-6SbbS", "data bytes are not json") - } - dataType := reflect.TypeOf(event.Data()) - if dataType.Kind() == reflect.Ptr { - dataType = dataType.Elem() - } - if dataType.Kind() == reflect.Struct { - dataBytes, err := json.Marshal(event.Data()) - if err != nil { - return nil, errors.ThrowInvalidArgument(err, "V2-xG87M", "could not marshal data") - } - return dataBytes, nil - } - return nil, errors.ThrowInvalidArgument(nil, "V2-91NRm", "wrong type of event data") -} - -func uniqueConstraintActionToRepository(action UniqueConstraintAction) repository.UniqueConstraintAction { - switch action { - case UniqueConstraintAdd: - return repository.UniqueConstraintAdd - case UniqueConstraintRemove: - return repository.UniqueConstraintRemoved - default: - return repository.UniqueConstraintAdd - } -} diff --git a/internal/eventstore/v2/version.go b/internal/eventstore/version.go similarity index 51% rename from internal/eventstore/v2/version.go rename to internal/eventstore/version.go index 0b36850fc9..cbbd6ffe91 100644 --- a/internal/eventstore/v2/version.go +++ b/internal/eventstore/version.go @@ -1,7 +1,7 @@ package eventstore import ( - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) type Version repository.Version diff --git a/internal/eventstore/v2/write_model.go b/internal/eventstore/write_model.go similarity index 100% rename from internal/eventstore/v2/write_model.go rename to internal/eventstore/write_model.go diff --git a/internal/iam/model/iam.go b/internal/iam/model/iam.go index febe8f1422..76b654ba6e 100644 --- a/internal/iam/model/iam.go +++ b/internal/iam/model/iam.go @@ -1,8 +1,8 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Step int diff --git a/internal/iam/model/iam_member.go b/internal/iam/model/iam_member.go index f2531f46e8..35ca864f4e 100644 --- a/internal/iam/model/iam_member.go +++ b/internal/iam/model/iam_member.go @@ -1,6 +1,6 @@ package model -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type IAMMember struct { es_models.ObjectRoot diff --git a/internal/iam/model/idp_config.go b/internal/iam/model/idp_config.go index 29616d8d77..c02e15ecb6 100644 --- a/internal/iam/model/idp_config.go +++ b/internal/iam/model/idp_config.go @@ -2,7 +2,7 @@ package model import ( "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type IDPConfig struct { diff --git a/internal/iam/model/idp_provider_view.go b/internal/iam/model/idp_provider_view.go index 0ac112147e..7686f857f4 100644 --- a/internal/iam/model/idp_provider_view.go +++ b/internal/iam/model/idp_provider_view.go @@ -1,8 +1,8 @@ package model import ( + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/model" - "github.com/caos/zitadel/internal/v2/domain" "time" ) diff --git a/internal/iam/model/label_policy.go b/internal/iam/model/label_policy.go index ead99759a0..ade2e4a551 100644 --- a/internal/iam/model/label_policy.go +++ b/internal/iam/model/label_policy.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type LabelPolicy struct { diff --git a/internal/iam/model/login_policy.go b/internal/iam/model/login_policy.go index bdfa63755e..75e218ec92 100644 --- a/internal/iam/model/login_policy.go +++ b/internal/iam/model/login_policy.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type LoginPolicy struct { diff --git a/internal/iam/model/login_policy_view.go b/internal/iam/model/login_policy_view.go index 488e6e7204..43183eda66 100644 --- a/internal/iam/model/login_policy_view.go +++ b/internal/iam/model/login_policy_view.go @@ -1,9 +1,9 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/model" - "github.com/caos/zitadel/internal/v2/domain" "time" ) diff --git a/internal/iam/model/mail_template.go b/internal/iam/model/mail_template.go index 8efeeff61b..99e94bace3 100644 --- a/internal/iam/model/mail_template.go +++ b/internal/iam/model/mail_template.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type MailTemplate struct { diff --git a/internal/iam/model/mail_text.go b/internal/iam/model/mail_text.go index b0dd60b00a..353ab70f1f 100644 --- a/internal/iam/model/mail_text.go +++ b/internal/iam/model/mail_text.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type MailTexts struct { diff --git a/internal/iam/model/org_iam_policy.go b/internal/iam/model/org_iam_policy.go index 2bbf876660..b4c08e1e0f 100644 --- a/internal/iam/model/org_iam_policy.go +++ b/internal/iam/model/org_iam_policy.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type OrgIAMPolicy struct { diff --git a/internal/iam/model/password_age_policy.go b/internal/iam/model/password_age_policy.go index e3eed17d48..1b1940025a 100644 --- a/internal/iam/model/password_age_policy.go +++ b/internal/iam/model/password_age_policy.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type PasswordAgePolicy struct { diff --git a/internal/iam/model/password_complexity_policy.go b/internal/iam/model/password_complexity_policy.go index 851343ecff..6a5b3f65a6 100644 --- a/internal/iam/model/password_complexity_policy.go +++ b/internal/iam/model/password_complexity_policy.go @@ -2,7 +2,7 @@ package model import ( caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "regexp" ) diff --git a/internal/iam/model/password_lockout_policy.go b/internal/iam/model/password_lockout_policy.go index 7cee02a14e..9e655921a1 100644 --- a/internal/iam/model/password_lockout_policy.go +++ b/internal/iam/model/password_lockout_policy.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) type PasswordLockoutPolicy struct { diff --git a/internal/iam/repository/eventsourcing/cache.go b/internal/iam/repository/eventsourcing/cache.go index 0c66e52f44..3bf3c7afde 100644 --- a/internal/iam/repository/eventsourcing/cache.go +++ b/internal/iam/repository/eventsourcing/cache.go @@ -4,7 +4,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/cache" "github.com/caos/zitadel/internal/cache/config" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/iam/repository/eventsourcing/eventstore.go b/internal/iam/repository/eventsourcing/eventstore.go index 65b098d69c..ad78d4ae08 100644 --- a/internal/iam/repository/eventsourcing/eventstore.go +++ b/internal/iam/repository/eventsourcing/eventstore.go @@ -2,10 +2,10 @@ package eventsourcing import ( "github.com/caos/zitadel/internal/cache/config" - es_int "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" ) type IAMConfig struct { - es_int.Eventstore + v1.Eventstore Cache *config.CacheConfig } diff --git a/internal/iam/repository/eventsourcing/iam.go b/internal/iam/repository/eventsourcing/iam.go index d8d99f1889..a4bdf6b674 100644 --- a/internal/iam/repository/eventsourcing/iam.go +++ b/internal/iam/repository/eventsourcing/iam.go @@ -4,7 +4,7 @@ import ( "context" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/iam/repository/eventsourcing/model/iam.go b/internal/iam/repository/eventsourcing/model/iam.go index f67bb55edb..b172b088d9 100644 --- a/internal/iam/repository/eventsourcing/model/iam.go +++ b/internal/iam/repository/eventsourcing/model/iam.go @@ -4,10 +4,10 @@ import ( "encoding/json" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( diff --git a/internal/iam/repository/eventsourcing/model/iam_member.go b/internal/iam/repository/eventsourcing/model/iam_member.go index 1bd718ffb8..42f4340801 100644 --- a/internal/iam/repository/eventsourcing/model/iam_member.go +++ b/internal/iam/repository/eventsourcing/model/iam_member.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/caos/logging" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/eventsourcing/model/iam_member_test.go b/internal/iam/repository/eventsourcing/model/iam_member_test.go index 0ddae421d7..529f21dc5f 100644 --- a/internal/iam/repository/eventsourcing/model/iam_member_test.go +++ b/internal/iam/repository/eventsourcing/model/iam_member_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/iam/repository/eventsourcing/model/iam_test.go b/internal/iam/repository/eventsourcing/model/iam_test.go index e72d921c29..354da6211e 100644 --- a/internal/iam/repository/eventsourcing/model/iam_test.go +++ b/internal/iam/repository/eventsourcing/model/iam_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func mockIamData(iam *IAM) []byte { diff --git a/internal/iam/repository/eventsourcing/model/idp_config.go b/internal/iam/repository/eventsourcing/model/idp_config.go index 2da5c583ae..87cf340156 100644 --- a/internal/iam/repository/eventsourcing/model/idp_config.go +++ b/internal/iam/repository/eventsourcing/model/idp_config.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/caos/logging" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/eventsourcing/model/idp_config_test.go b/internal/iam/repository/eventsourcing/model/idp_config_test.go index f042e6ed7d..6cae444db6 100644 --- a/internal/iam/repository/eventsourcing/model/idp_config_test.go +++ b/internal/iam/repository/eventsourcing/model/idp_config_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" "testing" ) diff --git a/internal/iam/repository/eventsourcing/model/label_policy.go b/internal/iam/repository/eventsourcing/model/label_policy.go index 738b54fcb0..4b3ed90beb 100644 --- a/internal/iam/repository/eventsourcing/model/label_policy.go +++ b/internal/iam/repository/eventsourcing/model/label_policy.go @@ -4,13 +4,12 @@ import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" ) type LabelPolicy struct { - models.ObjectRoot + es_models.ObjectRoot State int32 `json:"-"` PrimaryColor string `json:"primaryColor"` SecondaryColor string `json:"secondaryColor"` diff --git a/internal/iam/repository/eventsourcing/model/label_policy_test.go b/internal/iam/repository/eventsourcing/model/label_policy_test.go index 094e51f28c..3e4d889404 100644 --- a/internal/iam/repository/eventsourcing/model/label_policy_test.go +++ b/internal/iam/repository/eventsourcing/model/label_policy_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestLabelPolicyChanges(t *testing.T) { diff --git a/internal/iam/repository/eventsourcing/model/login_policy.go b/internal/iam/repository/eventsourcing/model/login_policy.go index 4541cf4de1..b257ff6aea 100644 --- a/internal/iam/repository/eventsourcing/model/login_policy.go +++ b/internal/iam/repository/eventsourcing/model/login_policy.go @@ -4,13 +4,12 @@ import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" ) type LoginPolicy struct { - models.ObjectRoot + es_models.ObjectRoot State int32 `json:"-"` AllowUsernamePassword bool `json:"allowUsernamePassword"` AllowRegister bool `json:"allowRegister"` @@ -23,7 +22,7 @@ type LoginPolicy struct { } type IDPProvider struct { - models.ObjectRoot + es_models.ObjectRoot Type int32 `json:"idpProviderType"` IDPConfigID string `json:"idpConfigId"` } diff --git a/internal/iam/repository/eventsourcing/model/login_policy_test.go b/internal/iam/repository/eventsourcing/model/login_policy_test.go index a7a9164885..04f26a2f72 100644 --- a/internal/iam/repository/eventsourcing/model/login_policy_test.go +++ b/internal/iam/repository/eventsourcing/model/login_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" "testing" ) diff --git a/internal/iam/repository/eventsourcing/model/mail_template.go b/internal/iam/repository/eventsourcing/model/mail_template.go index b328089abd..7d175fdc52 100644 --- a/internal/iam/repository/eventsourcing/model/mail_template.go +++ b/internal/iam/repository/eventsourcing/model/mail_template.go @@ -5,13 +5,12 @@ import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" ) type MailTemplate struct { - models.ObjectRoot + es_models.ObjectRoot State int32 `json:"-"` Template []byte } diff --git a/internal/iam/repository/eventsourcing/model/mail_template_test.go b/internal/iam/repository/eventsourcing/model/mail_template_test.go index 279a059865..bff3ab571a 100644 --- a/internal/iam/repository/eventsourcing/model/mail_template_test.go +++ b/internal/iam/repository/eventsourcing/model/mail_template_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestMailTemplateChanges(t *testing.T) { diff --git a/internal/iam/repository/eventsourcing/model/mail_text.go b/internal/iam/repository/eventsourcing/model/mail_text.go index 912be7a7a0..27b85fef0a 100644 --- a/internal/iam/repository/eventsourcing/model/mail_text.go +++ b/internal/iam/repository/eventsourcing/model/mail_text.go @@ -4,13 +4,12 @@ import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" ) type MailText struct { - models.ObjectRoot + es_models.ObjectRoot State int32 `json:"-"` MailTextType string Language string diff --git a/internal/iam/repository/eventsourcing/model/mail_text_test.go b/internal/iam/repository/eventsourcing/model/mail_text_test.go index 84f5d1189e..557be25d55 100644 --- a/internal/iam/repository/eventsourcing/model/mail_text_test.go +++ b/internal/iam/repository/eventsourcing/model/mail_text_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestAppendAddMailTextEvent(t *testing.T) { diff --git a/internal/iam/repository/eventsourcing/model/oidc_idp_config.go b/internal/iam/repository/eventsourcing/model/oidc_idp_config.go index efd6a84e1c..1f8440df0d 100644 --- a/internal/iam/repository/eventsourcing/model/oidc_idp_config.go +++ b/internal/iam/repository/eventsourcing/model/oidc_idp_config.go @@ -4,7 +4,7 @@ import ( "encoding/json" "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" "github.com/lib/pq" "reflect" diff --git a/internal/iam/repository/eventsourcing/model/oidc_idp_config_test.go b/internal/iam/repository/eventsourcing/model/oidc_idp_config_test.go index df7e569226..7e16e5e1eb 100644 --- a/internal/iam/repository/eventsourcing/model/oidc_idp_config_test.go +++ b/internal/iam/repository/eventsourcing/model/oidc_idp_config_test.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/iam/repository/eventsourcing/model/org_iam_policy.go b/internal/iam/repository/eventsourcing/model/org_iam_policy.go index 1612d84c12..e8ab09fd90 100644 --- a/internal/iam/repository/eventsourcing/model/org_iam_policy.go +++ b/internal/iam/repository/eventsourcing/model/org_iam_policy.go @@ -4,13 +4,12 @@ import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" ) type OrgIAMPolicy struct { - models.ObjectRoot + es_models.ObjectRoot State int32 `json:"-"` UserLoginMustBeDomain bool `json:"userLoginMustBeDomain"` diff --git a/internal/iam/repository/eventsourcing/model/org_iam_policy_test.go b/internal/iam/repository/eventsourcing/model/org_iam_policy_test.go index 555c620b4c..c86fb532ff 100644 --- a/internal/iam/repository/eventsourcing/model/org_iam_policy_test.go +++ b/internal/iam/repository/eventsourcing/model/org_iam_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/iam/repository/eventsourcing/model/password_age_policy.go b/internal/iam/repository/eventsourcing/model/password_age_policy.go index 7d4b96d4d4..77469d82bf 100644 --- a/internal/iam/repository/eventsourcing/model/password_age_policy.go +++ b/internal/iam/repository/eventsourcing/model/password_age_policy.go @@ -4,13 +4,12 @@ import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" ) type PasswordAgePolicy struct { - models.ObjectRoot + es_models.ObjectRoot State int32 `json:"-"` MaxAgeDays uint64 `json:"maxAgeDays"` diff --git a/internal/iam/repository/eventsourcing/model/password_age_policy_test.go b/internal/iam/repository/eventsourcing/model/password_age_policy_test.go index 6e3b9132b3..765409f258 100644 --- a/internal/iam/repository/eventsourcing/model/password_age_policy_test.go +++ b/internal/iam/repository/eventsourcing/model/password_age_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/iam/repository/eventsourcing/model/password_complexity_policy.go b/internal/iam/repository/eventsourcing/model/password_complexity_policy.go index 148db9f422..43e45a5214 100644 --- a/internal/iam/repository/eventsourcing/model/password_complexity_policy.go +++ b/internal/iam/repository/eventsourcing/model/password_complexity_policy.go @@ -4,13 +4,12 @@ import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" ) type PasswordComplexityPolicy struct { - models.ObjectRoot + es_models.ObjectRoot State int32 `json:"-"` MinLength uint64 `json:"minLength"` diff --git a/internal/iam/repository/eventsourcing/model/password_complexity_policy_test.go b/internal/iam/repository/eventsourcing/model/password_complexity_policy_test.go index 7ea90dc279..5fe95de27d 100644 --- a/internal/iam/repository/eventsourcing/model/password_complexity_policy_test.go +++ b/internal/iam/repository/eventsourcing/model/password_complexity_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/iam/repository/eventsourcing/model/password_lockout_policy.go b/internal/iam/repository/eventsourcing/model/password_lockout_policy.go index 15c78c45ac..ba7793e9c8 100644 --- a/internal/iam/repository/eventsourcing/model/password_lockout_policy.go +++ b/internal/iam/repository/eventsourcing/model/password_lockout_policy.go @@ -4,13 +4,12 @@ import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" ) type PasswordLockoutPolicy struct { - models.ObjectRoot + es_models.ObjectRoot State int32 `json:"-"` MaxAttempts uint64 `json:"maxAttempts"` diff --git a/internal/iam/repository/eventsourcing/model/password_lockout_policy_test.go b/internal/iam/repository/eventsourcing/model/password_lockout_policy_test.go index 78e499da38..a7619c37c3 100644 --- a/internal/iam/repository/eventsourcing/model/password_lockout_policy_test.go +++ b/internal/iam/repository/eventsourcing/model/password_lockout_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/iam/repository/eventsourcing/model/types.go b/internal/iam/repository/eventsourcing/model/types.go index c558db062c..c07bfc5954 100644 --- a/internal/iam/repository/eventsourcing/model/types.go +++ b/internal/iam/repository/eventsourcing/model/types.go @@ -1,6 +1,6 @@ package model -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" const ( IAMAggregate models.AggregateType = "iam" diff --git a/internal/iam/repository/view/model/iam_member.go b/internal/iam/repository/view/model/iam_member.go index 574e765d96..fd86f18839 100644 --- a/internal/iam/repository/view/model/iam_member.go +++ b/internal/iam/repository/view/model/iam_member.go @@ -8,7 +8,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" "github.com/lib/pq" ) diff --git a/internal/iam/repository/view/model/idp_config.go b/internal/iam/repository/view/model/idp_config.go index 049a898c09..52c6020900 100644 --- a/internal/iam/repository/view/model/idp_config.go +++ b/internal/iam/repository/view/model/idp_config.go @@ -10,7 +10,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" "github.com/lib/pq" ) diff --git a/internal/iam/repository/view/model/idp_provider.go b/internal/iam/repository/view/model/idp_provider.go index e4f2270aac..b6050c77ca 100644 --- a/internal/iam/repository/view/model/idp_provider.go +++ b/internal/iam/repository/view/model/idp_provider.go @@ -9,7 +9,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/model/label_policy.go b/internal/iam/repository/view/model/label_policy.go index 0f9e4ad70f..a3c4f630c5 100644 --- a/internal/iam/repository/view/model/label_policy.go +++ b/internal/iam/repository/view/model/label_policy.go @@ -10,7 +10,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/model/login_policy.go b/internal/iam/repository/view/model/login_policy.go index 9291e8faad..f180d14b11 100644 --- a/internal/iam/repository/view/model/login_policy.go +++ b/internal/iam/repository/view/model/login_policy.go @@ -10,7 +10,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/model/mail_template.go b/internal/iam/repository/view/model/mail_template.go index 29ab111d43..c2ff7758b7 100644 --- a/internal/iam/repository/view/model/mail_template.go +++ b/internal/iam/repository/view/model/mail_template.go @@ -10,7 +10,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/model/mail_text.go b/internal/iam/repository/view/model/mail_text.go index 959f9d3fce..6812ec8473 100644 --- a/internal/iam/repository/view/model/mail_text.go +++ b/internal/iam/repository/view/model/mail_text.go @@ -10,7 +10,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/model/org_iam_policy.go b/internal/iam/repository/view/model/org_iam_policy.go index ca2aca0910..d40fcd5481 100644 --- a/internal/iam/repository/view/model/org_iam_policy.go +++ b/internal/iam/repository/view/model/org_iam_policy.go @@ -9,7 +9,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/model/password_age_policy.go b/internal/iam/repository/view/model/password_age_policy.go index 99a8bafa7e..dfc3dec7d8 100644 --- a/internal/iam/repository/view/model/password_age_policy.go +++ b/internal/iam/repository/view/model/password_age_policy.go @@ -9,7 +9,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/model/password_complexity_policy.go b/internal/iam/repository/view/model/password_complexity_policy.go index dd52e57657..4a3f9bd0fd 100644 --- a/internal/iam/repository/view/model/password_complexity_policy.go +++ b/internal/iam/repository/view/model/password_complexity_policy.go @@ -9,7 +9,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/model/password_lockout_policy.go b/internal/iam/repository/view/model/password_lockout_policy.go index 6b73692257..371942ff76 100644 --- a/internal/iam/repository/view/model/password_lockout_policy.go +++ b/internal/iam/repository/view/model/password_lockout_policy.go @@ -9,7 +9,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/iam/repository/view/query.go b/internal/iam/repository/view/query.go index 7a40b7b92f..23a3e41986 100644 --- a/internal/iam/repository/view/query.go +++ b/internal/iam/repository/view/query.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/key/model/authn_key.go b/internal/key/model/authn_key.go index 417c812a3e..d0280e5b3a 100644 --- a/internal/key/model/authn_key.go +++ b/internal/key/model/authn_key.go @@ -3,7 +3,7 @@ package model import ( "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/model" ) diff --git a/internal/key/model/key.go b/internal/key/model/key.go index a0af401dc1..d6ad595270 100644 --- a/internal/key/model/key.go +++ b/internal/key/model/key.go @@ -4,7 +4,7 @@ import ( "time" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type KeyPair struct { diff --git a/internal/key/repository/eventsourcing/key.go b/internal/key/repository/eventsourcing/key.go index 02a5ffac51..465406a31c 100644 --- a/internal/key/repository/eventsourcing/key.go +++ b/internal/key/repository/eventsourcing/key.go @@ -1,7 +1,7 @@ package eventsourcing import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/key/repository/eventsourcing/model" ) diff --git a/internal/key/repository/eventsourcing/model/key.go b/internal/key/repository/eventsourcing/model/key.go index 50325612dd..04e2afd899 100644 --- a/internal/key/repository/eventsourcing/model/key.go +++ b/internal/key/repository/eventsourcing/model/key.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/key/model" ) diff --git a/internal/key/repository/eventsourcing/model/types.go b/internal/key/repository/eventsourcing/model/types.go index 2a7975ec04..2f0d710e60 100644 --- a/internal/key/repository/eventsourcing/model/types.go +++ b/internal/key/repository/eventsourcing/model/types.go @@ -1,6 +1,6 @@ package model -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" const ( KeyPairAggregate models.AggregateType = "key_pair" diff --git a/internal/key/repository/view/model/authn_key.go b/internal/key/repository/view/model/authn_key.go index 200c5b36be..b1ae8b933f 100644 --- a/internal/key/repository/view/model/authn_key.go +++ b/internal/key/repository/view/model/authn_key.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/key/model" proj_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" proj_view_model "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/key/repository/view/model/key.go b/internal/key/repository/view/model/key.go index f65769ad9e..056a53bb3b 100644 --- a/internal/key/repository/view/model/key.go +++ b/internal/key/repository/view/model/key.go @@ -9,7 +9,7 @@ import ( "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/key/model" es_model "github.com/caos/zitadel/internal/key/repository/eventsourcing/model" ) diff --git a/internal/key/repository/view/query.go b/internal/key/repository/view/query.go index 172527c6e9..521c5905f8 100644 --- a/internal/key/repository/view/query.go +++ b/internal/key/repository/view/query.go @@ -1,8 +1,8 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) func KeyPairQuery(latestSequence uint64) *eventstore.SearchQueryBuilder { diff --git a/internal/management/repository/eventsourcing/eventstore/iam.go b/internal/management/repository/eventsourcing/eventstore/iam.go index 1024913d4a..c78adec356 100644 --- a/internal/management/repository/eventsourcing/eventstore/iam.go +++ b/internal/management/repository/eventsourcing/eventstore/iam.go @@ -2,7 +2,7 @@ package eventstore import ( "context" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/query" iam_model "github.com/caos/zitadel/internal/iam/model" ) diff --git a/internal/management/repository/eventsourcing/eventstore/org.go b/internal/management/repository/eventsourcing/eventstore/org.go index 5ab5e9602f..e547b07cd1 100644 --- a/internal/management/repository/eventsourcing/eventstore/org.go +++ b/internal/management/repository/eventsourcing/eventstore/org.go @@ -3,13 +3,13 @@ package eventstore import ( "context" "encoding/json" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_view "github.com/caos/zitadel/internal/iam/repository/view" org_view "github.com/caos/zitadel/internal/org/repository/view" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" - "github.com/caos/zitadel/internal/v2/domain" "github.com/golang/protobuf/ptypes" "strings" @@ -35,7 +35,7 @@ const ( type OrgRepository struct { SearchLimit uint64 - Eventstore eventstore.Eventstore + Eventstore v1.Eventstore View *mgmt_view.View Roles []string SystemDefaults systemdefaults.SystemDefaults diff --git a/internal/management/repository/eventsourcing/eventstore/project.go b/internal/management/repository/eventsourcing/eventstore/project.go index e67082394d..5661bb6a1f 100644 --- a/internal/management/repository/eventsourcing/eventstore/project.go +++ b/internal/management/repository/eventsourcing/eventstore/project.go @@ -3,11 +3,12 @@ package eventstore import ( "context" "encoding/json" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" - "github.com/caos/zitadel/internal/v2/domain" "strings" "github.com/caos/logging" @@ -16,8 +17,7 @@ import ( "github.com/caos/zitadel/internal/api/authz" caos_errs "github.com/caos/zitadel/internal/errors" - es_int "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" key_model "github.com/caos/zitadel/internal/key/model" key_view_model "github.com/caos/zitadel/internal/key/repository/view/model" "github.com/caos/zitadel/internal/management/repository/eventsourcing/view" @@ -31,7 +31,7 @@ import ( ) type ProjectRepo struct { - es_int.Eventstore + v1.Eventstore SearchLimit uint64 View *view.View Roles []string diff --git a/internal/management/repository/eventsourcing/eventstore/user.go b/internal/management/repository/eventsourcing/eventstore/user.go index cbf16b5b72..4be60f4731 100644 --- a/internal/management/repository/eventsourcing/eventstore/user.go +++ b/internal/management/repository/eventsourcing/eventstore/user.go @@ -2,7 +2,8 @@ package eventstore import ( "context" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_view "github.com/caos/zitadel/internal/user/repository/view" "github.com/golang/protobuf/ptypes" @@ -12,7 +13,6 @@ import ( "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" - es_int "github.com/caos/zitadel/internal/eventstore" key_model "github.com/caos/zitadel/internal/key/model" key_view_model "github.com/caos/zitadel/internal/key/repository/view/model" "github.com/caos/zitadel/internal/management/repository/eventsourcing/view" @@ -23,7 +23,7 @@ import ( ) type UserRepo struct { - es_int.Eventstore + v1.Eventstore SearchLimit uint64 View *view.View SystemDefaults systemdefaults.SystemDefaults diff --git a/internal/management/repository/eventsourcing/handler/application.go b/internal/management/repository/eventsourcing/handler/application.go index 3f2b32394e..5ada9f92bf 100644 --- a/internal/management/repository/eventsourcing/handler/application.go +++ b/internal/management/repository/eventsourcing/handler/application.go @@ -2,15 +2,15 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" proj_model "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" proj_view "github.com/caos/zitadel/internal/project/repository/view" @@ -23,7 +23,7 @@ const ( type Application struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newApplication( diff --git a/internal/management/repository/eventsourcing/handler/authn_keys.go b/internal/management/repository/eventsourcing/handler/authn_keys.go index 0003010033..b5e7e82daa 100644 --- a/internal/management/repository/eventsourcing/handler/authn_keys.go +++ b/internal/management/repository/eventsourcing/handler/authn_keys.go @@ -1,14 +1,14 @@ package handler import ( + "github.com/caos/zitadel/internal/eventstore/v1" "time" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" key_model "github.com/caos/zitadel/internal/key/repository/view/model" proj_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" user_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" @@ -20,7 +20,7 @@ const ( type AuthNKeys struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newAuthNKeys(handler handler) *AuthNKeys { diff --git a/internal/management/repository/eventsourcing/handler/handler.go b/internal/management/repository/eventsourcing/handler/handler.go index 0d0248a4b5..6ae5d28982 100644 --- a/internal/management/repository/eventsourcing/handler/handler.go +++ b/internal/management/repository/eventsourcing/handler/handler.go @@ -1,12 +1,12 @@ package handler import ( + "github.com/caos/zitadel/internal/eventstore/v1" "time" "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/config/types" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/query" + "github.com/caos/zitadel/internal/eventstore/v1/query" "github.com/caos/zitadel/internal/management/repository/eventsourcing/view" ) @@ -22,14 +22,14 @@ type handler struct { cycleDuration time.Duration errorCountUntilSkip uint64 - es eventstore.Eventstore + es v1.Eventstore } -func (h *handler) Eventstore() eventstore.Eventstore { +func (h *handler) Eventstore() v1.Eventstore { return h.es } -func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es eventstore.Eventstore, defaults systemdefaults.SystemDefaults) []query.Handler { +func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es v1.Eventstore, defaults systemdefaults.SystemDefaults) []query.Handler { return []query.Handler{ newProject( handler{view, bulkLimit, configs.cycleDuration("Project"), errorCount, es}), diff --git a/internal/management/repository/eventsourcing/handler/idp_config.go b/internal/management/repository/eventsourcing/handler/idp_config.go index 5f86992807..b64ab7984d 100644 --- a/internal/management/repository/eventsourcing/handler/idp_config.go +++ b/internal/management/repository/eventsourcing/handler/idp_config.go @@ -2,11 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -19,7 +19,7 @@ const ( type IDPConfig struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newIDPConfig(handler handler) *IDPConfig { diff --git a/internal/management/repository/eventsourcing/handler/idp_providers.go b/internal/management/repository/eventsourcing/handler/idp_providers.go index e8bfcd0206..71cfb70e02 100644 --- a/internal/management/repository/eventsourcing/handler/idp_providers.go +++ b/internal/management/repository/eventsourcing/handler/idp_providers.go @@ -4,12 +4,13 @@ import ( "context" "github.com/caos/logging" "github.com/caos/zitadel/internal/config/systemdefaults" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" @@ -17,7 +18,6 @@ import ( org_model "github.com/caos/zitadel/internal/org/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -27,7 +27,7 @@ const ( type IDPProvider struct { handler systemDefaults systemdefaults.SystemDefaults - subscription *eventstore.Subscription + subscription *v1.Subscription } func newIDPProvider( diff --git a/internal/management/repository/eventsourcing/handler/label_policy.go b/internal/management/repository/eventsourcing/handler/label_policy.go index b56cadbd8a..7228d8b994 100644 --- a/internal/management/repository/eventsourcing/handler/label_policy.go +++ b/internal/management/repository/eventsourcing/handler/label_policy.go @@ -2,11 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -18,7 +17,7 @@ const ( type LabelPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newLabelPolicy(handler handler) *LabelPolicy { @@ -44,8 +43,8 @@ func (m *LabelPolicy) ViewModel() string { return labelPolicyTable } -func (_ *LabelPolicy) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} +func (_ *LabelPolicy) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} } func (m *LabelPolicy) CurrentSequence() (uint64, error) { @@ -56,7 +55,7 @@ func (m *LabelPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *LabelPolicy) EventQuery() (*models.SearchQuery, error) { +func (m *LabelPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestLabelPolicySequence() if err != nil { return nil, err @@ -66,7 +65,7 @@ func (m *LabelPolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *LabelPolicy) Reduce(event *models.Event) (err error) { +func (m *LabelPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = m.processLabelPolicy(event) @@ -74,7 +73,7 @@ func (m *LabelPolicy) Reduce(event *models.Event) (err error) { return err } -func (m *LabelPolicy) processLabelPolicy(event *models.Event) (err error) { +func (m *LabelPolicy) processLabelPolicy(event *es_models.Event) (err error) { policy := new(iam_model.LabelPolicyView) switch event.Type { case iam_es_model.LabelPolicyAdded, model.LabelPolicyAdded: @@ -94,7 +93,7 @@ func (m *LabelPolicy) processLabelPolicy(event *models.Event) (err error) { return m.view.PutLabelPolicy(policy, event) } -func (m *LabelPolicy) OnError(event *models.Event, err error) error { +func (m *LabelPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-4Djo9", "id", event.AggregateID).WithError(err).Warn("something went wrong in label policy handler") return spooler.HandleError(event, err, m.view.GetLatestLabelPolicyFailedEvent, m.view.ProcessedLabelPolicyFailedEvent, m.view.ProcessedLabelPolicySequence, m.errorCountUntilSkip) } diff --git a/internal/management/repository/eventsourcing/handler/login_policy.go b/internal/management/repository/eventsourcing/handler/login_policy.go index ed1d42f654..403c3838ae 100644 --- a/internal/management/repository/eventsourcing/handler/login_policy.go +++ b/internal/management/repository/eventsourcing/handler/login_policy.go @@ -3,17 +3,16 @@ package handler import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/iam/repository/eventsourcing" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -22,7 +21,7 @@ const ( type LoginPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newLoginPolicy(handler handler) *LoginPolicy { @@ -48,8 +47,8 @@ func (m *LoginPolicy) ViewModel() string { return loginPolicyTable } -func (_ *LoginPolicy) AggregateTypes() []models.AggregateType { - return []models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} +func (_ *LoginPolicy) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{model.OrgAggregate, iam_es_model.IAMAggregate} } func (m *LoginPolicy) CurrentSequence() (uint64, error) { @@ -60,7 +59,7 @@ func (m *LoginPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *LoginPolicy) EventQuery() (*models.SearchQuery, error) { +func (m *LoginPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestLoginPolicySequence() if err != nil { return nil, err @@ -70,7 +69,7 @@ func (m *LoginPolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *LoginPolicy) Reduce(event *models.Event) (err error) { +func (m *LoginPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = m.processLoginPolicy(event) @@ -78,7 +77,7 @@ func (m *LoginPolicy) Reduce(event *models.Event) (err error) { return err } -func (m *LoginPolicy) processLoginPolicy(event *models.Event) (err error) { +func (m *LoginPolicy) processLoginPolicy(event *es_models.Event) (err error) { policy := new(iam_model.LoginPolicyView) switch event.Type { case model.OrgAdded: @@ -132,7 +131,7 @@ func (m *LoginPolicy) processLoginPolicy(event *models.Event) (err error) { return m.view.PutLoginPolicy(policy, event) } -func (m *LoginPolicy) OnError(event *models.Event, err error) error { +func (m *LoginPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-4Djo9", "id", event.AggregateID).WithError(err).Warn("something went wrong in login policy handler") return spooler.HandleError(event, err, m.view.GetLatestLoginPolicyFailedEvent, m.view.ProcessedLoginPolicyFailedEvent, m.view.ProcessedLoginPolicySequence, m.errorCountUntilSkip) } @@ -162,7 +161,7 @@ func (p *LoginPolicy) getDefaultLoginPolicy() (*iam_model.LoginPolicyView, error return &policyCopy, nil } -func (p *LoginPolicy) getIAMEvents(sequence uint64) ([]*models.Event, error) { +func (p *LoginPolicy) getIAMEvents(sequence uint64) ([]*es_models.Event, error) { query, err := eventsourcing.IAMByIDQuery(domain.IAMID, sequence) if err != nil { return nil, err diff --git a/internal/management/repository/eventsourcing/handler/mail_template.go b/internal/management/repository/eventsourcing/handler/mail_template.go index 14b529193c..7ccf60a4d6 100644 --- a/internal/management/repository/eventsourcing/handler/mail_template.go +++ b/internal/management/repository/eventsourcing/handler/mail_template.go @@ -2,20 +2,19 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) type MailTemplate struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newMailTemplate(handler handler) *MailTemplate { @@ -57,7 +56,7 @@ func (p *MailTemplate) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *MailTemplate) EventQuery() (*models.SearchQuery, error) { +func (m *MailTemplate) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestMailTemplateSequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (m *MailTemplate) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *MailTemplate) Reduce(event *models.Event) (err error) { +func (m *MailTemplate) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = m.processMailTemplate(event) @@ -75,7 +74,7 @@ func (m *MailTemplate) Reduce(event *models.Event) (err error) { return err } -func (m *MailTemplate) processMailTemplate(event *models.Event) (err error) { +func (m *MailTemplate) processMailTemplate(event *es_models.Event) (err error) { template := new(iam_model.MailTemplateView) switch event.Type { case iam_es_model.MailTemplateAdded, model.MailTemplateAdded: @@ -97,7 +96,7 @@ func (m *MailTemplate) processMailTemplate(event *models.Event) (err error) { return m.view.PutMailTemplate(template, event) } -func (m *MailTemplate) OnError(event *models.Event, err error) error { +func (m *MailTemplate) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-4Djo9", "id", event.AggregateID).WithError(err).Warn("something went wrong in label template handler") return spooler.HandleError(event, err, m.view.GetLatestMailTemplateFailedEvent, m.view.ProcessedMailTemplateFailedEvent, m.view.ProcessedMailTemplateSequence, m.errorCountUntilSkip) } diff --git a/internal/management/repository/eventsourcing/handler/mail_text.go b/internal/management/repository/eventsourcing/handler/mail_text.go index 9cf65a2e28..a11383cbc1 100644 --- a/internal/management/repository/eventsourcing/handler/mail_text.go +++ b/internal/management/repository/eventsourcing/handler/mail_text.go @@ -2,20 +2,19 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) type MailText struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newMailText(handler handler) *MailText { @@ -57,7 +56,7 @@ func (p *MailText) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *MailText) EventQuery() (*models.SearchQuery, error) { +func (m *MailText) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestMailTextSequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (m *MailText) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *MailText) Reduce(event *models.Event) (err error) { +func (m *MailText) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = m.processMailText(event) @@ -75,7 +74,7 @@ func (m *MailText) Reduce(event *models.Event) (err error) { return err } -func (m *MailText) processMailText(event *models.Event) (err error) { +func (m *MailText) processMailText(event *es_models.Event) (err error) { text := new(iam_model.MailTextView) switch event.Type { case iam_es_model.MailTextAdded, model.MailTextAdded: @@ -103,7 +102,7 @@ func (m *MailText) processMailText(event *models.Event) (err error) { return m.view.PutMailText(text, event) } -func (m *MailText) OnError(event *models.Event, err error) error { +func (m *MailText) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-4Djo9", "id", event.AggregateID).WithError(err).Warn("something went wrong in label text handler") return spooler.HandleError(event, err, m.view.GetLatestMailTextFailedEvent, m.view.ProcessedMailTextFailedEvent, m.view.ProcessedMailTextSequence, m.errorCountUntilSkip) } diff --git a/internal/management/repository/eventsourcing/handler/org.go b/internal/management/repository/eventsourcing/handler/org.go index 16ba3c228d..562a172711 100644 --- a/internal/management/repository/eventsourcing/handler/org.go +++ b/internal/management/repository/eventsourcing/handler/org.go @@ -2,12 +2,12 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/repository/view/model" ) @@ -18,7 +18,7 @@ const ( type Org struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrg(handler handler) *Org { diff --git a/internal/management/repository/eventsourcing/handler/org_domain.go b/internal/management/repository/eventsourcing/handler/org_domain.go index 963f518592..0f53dbeeca 100644 --- a/internal/management/repository/eventsourcing/handler/org_domain.go +++ b/internal/management/repository/eventsourcing/handler/org_domain.go @@ -2,11 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/repository/view/model" ) @@ -17,7 +16,7 @@ const ( type OrgDomain struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrgDomain(handler handler) *OrgDomain { @@ -55,7 +54,7 @@ func (p *OrgDomain) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (d *OrgDomain) EventQuery() (*models.SearchQuery, error) { +func (d *OrgDomain) EventQuery() (*es_models.SearchQuery, error) { sequence, err := d.view.GetLatestOrgDomainSequence() if err != nil { return nil, err @@ -65,7 +64,7 @@ func (d *OrgDomain) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (d *OrgDomain) Reduce(event *models.Event) (err error) { +func (d *OrgDomain) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate: err = d.processOrgDomain(event) @@ -73,7 +72,7 @@ func (d *OrgDomain) Reduce(event *models.Event) (err error) { return err } -func (d *OrgDomain) processOrgDomain(event *models.Event) (err error) { +func (d *OrgDomain) processOrgDomain(event *es_models.Event) (err error) { domain := new(org_model.OrgDomainView) switch event.Type { case model.OrgDomainAdded: @@ -125,7 +124,7 @@ func (d *OrgDomain) processOrgDomain(event *models.Event) (err error) { return d.view.PutOrgDomain(domain, event) } -func (d *OrgDomain) OnError(event *models.Event, err error) error { +func (d *OrgDomain) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-us4sj", "id", event.AggregateID).WithError(err).Warn("something went wrong in orgdomain handler") return spooler.HandleError(event, err, d.view.GetLatestOrgDomainFailedEvent, d.view.ProcessedOrgDomainFailedEvent, d.view.ProcessedOrgDomainSequence, d.errorCountUntilSkip) } diff --git a/internal/management/repository/eventsourcing/handler/org_iam_policy.go b/internal/management/repository/eventsourcing/handler/org_iam_policy.go index 636b37ff6f..e194e0dfa1 100644 --- a/internal/management/repository/eventsourcing/handler/org_iam_policy.go +++ b/internal/management/repository/eventsourcing/handler/org_iam_policy.go @@ -2,11 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -18,7 +17,7 @@ const ( type OrgIAMPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrgIAMPolicy(handler handler) *OrgIAMPolicy { @@ -56,7 +55,7 @@ func (p *OrgIAMPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *OrgIAMPolicy) EventQuery() (*models.SearchQuery, error) { +func (m *OrgIAMPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestOrgIAMPolicySequence() if err != nil { return nil, err @@ -66,7 +65,7 @@ func (m *OrgIAMPolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *OrgIAMPolicy) Reduce(event *models.Event) (err error) { +func (m *OrgIAMPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = m.processOrgIAMPolicy(event) @@ -74,7 +73,7 @@ func (m *OrgIAMPolicy) Reduce(event *models.Event) (err error) { return err } -func (m *OrgIAMPolicy) processOrgIAMPolicy(event *models.Event) (err error) { +func (m *OrgIAMPolicy) processOrgIAMPolicy(event *es_models.Event) (err error) { policy := new(iam_model.OrgIAMPolicyView) switch event.Type { case iam_es_model.OrgIAMPolicyAdded, model.OrgIAMPolicyAdded: @@ -96,7 +95,7 @@ func (m *OrgIAMPolicy) processOrgIAMPolicy(event *models.Event) (err error) { return m.view.PutOrgIAMPolicy(policy, event) } -func (m *OrgIAMPolicy) OnError(event *models.Event, err error) error { +func (m *OrgIAMPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-3Gf9s", "id", event.AggregateID).WithError(err).Warn("something went wrong in orgIAM policy handler") return spooler.HandleError(event, err, m.view.GetLatestOrgIAMPolicyFailedEvent, m.view.ProcessedOrgIAMPolicyFailedEvent, m.view.ProcessedOrgIAMPolicySequence, m.errorCountUntilSkip) } diff --git a/internal/management/repository/eventsourcing/handler/org_member.go b/internal/management/repository/eventsourcing/handler/org_member.go index eef888e5ec..bf0262dc3e 100644 --- a/internal/management/repository/eventsourcing/handler/org_member.go +++ b/internal/management/repository/eventsourcing/handler/org_member.go @@ -3,14 +3,13 @@ package handler import ( "context" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/repository/view/model" usr_model "github.com/caos/zitadel/internal/user/model" @@ -24,7 +23,7 @@ const ( type OrgMember struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newOrgMember( @@ -64,7 +63,7 @@ func (p *OrgMember) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (m *OrgMember) EventQuery() (*models.SearchQuery, error) { +func (m *OrgMember) EventQuery() (*es_models.SearchQuery, error) { sequence, err := m.view.GetLatestOrgMemberSequence() if err != nil { return nil, err @@ -74,7 +73,7 @@ func (m *OrgMember) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *OrgMember) Reduce(event *models.Event) (err error) { +func (m *OrgMember) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate: err = m.processOrgMember(event) @@ -84,7 +83,7 @@ func (m *OrgMember) Reduce(event *models.Event) (err error) { return err } -func (m *OrgMember) processOrgMember(event *models.Event) (err error) { +func (m *OrgMember) processOrgMember(event *es_models.Event) (err error) { member := new(org_model.OrgMemberView) switch event.Type { case model.OrgMemberAdded: @@ -118,7 +117,7 @@ func (m *OrgMember) processOrgMember(event *models.Event) (err error) { return m.view.PutOrgMember(member, event) } -func (m *OrgMember) processUser(event *models.Event) (err error) { +func (m *OrgMember) processUser(event *es_models.Event) (err error) { switch event.Type { case usr_es_model.UserProfileChanged, usr_es_model.UserEmailChanged, @@ -168,7 +167,7 @@ func (m *OrgMember) fillUserData(member *org_model.OrgMemberView, user *usr_view member.DisplayName = user.MachineView.Name } } -func (m *OrgMember) OnError(event *models.Event, err error) error { +func (m *OrgMember) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-u73es", "id", event.AggregateID).WithError(err).Warn("something went wrong in orgmember handler") return spooler.HandleError(event, err, m.view.GetLatestOrgMemberFailedEvent, m.view.ProcessedOrgMemberFailedEvent, m.view.ProcessedOrgMemberSequence, m.errorCountUntilSkip) } @@ -201,7 +200,7 @@ func (u *OrgMember) getUserByID(userID string) (*usr_view_model.UserView, error) return &userCopy, nil } -func (u *OrgMember) getUserEvents(userID string, sequence uint64) ([]*models.Event, error) { +func (u *OrgMember) getUserEvents(userID string, sequence uint64) ([]*es_models.Event, error) { query, err := view.UserByIDQuery(userID, sequence) if err != nil { return nil, err diff --git a/internal/management/repository/eventsourcing/handler/password_age_policy.go b/internal/management/repository/eventsourcing/handler/password_age_policy.go index 1e5bc2ba75..e798cfbbd1 100644 --- a/internal/management/repository/eventsourcing/handler/password_age_policy.go +++ b/internal/management/repository/eventsourcing/handler/password_age_policy.go @@ -2,11 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -18,7 +17,7 @@ const ( type PasswordAgePolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newPasswordAgePolicy(handler handler) *PasswordAgePolicy { @@ -56,7 +55,7 @@ func (o *PasswordAgePolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *PasswordAgePolicy) EventQuery() (*models.SearchQuery, error) { +func (p *PasswordAgePolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestPasswordAgePolicySequence() if err != nil { return nil, err @@ -66,7 +65,7 @@ func (p *PasswordAgePolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (m *PasswordAgePolicy) Reduce(event *models.Event) (err error) { +func (m *PasswordAgePolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = m.processPasswordAgePolicy(event) @@ -74,7 +73,7 @@ func (m *PasswordAgePolicy) Reduce(event *models.Event) (err error) { return err } -func (m *PasswordAgePolicy) processPasswordAgePolicy(event *models.Event) (err error) { +func (m *PasswordAgePolicy) processPasswordAgePolicy(event *es_models.Event) (err error) { policy := new(iam_model.PasswordAgePolicyView) switch event.Type { case iam_es_model.PasswordAgePolicyAdded, model.PasswordAgePolicyAdded: @@ -96,7 +95,7 @@ func (m *PasswordAgePolicy) processPasswordAgePolicy(event *models.Event) (err e return m.view.PutPasswordAgePolicy(policy, event) } -func (m *PasswordAgePolicy) OnError(event *models.Event, err error) error { +func (m *PasswordAgePolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Bs89f", "id", event.AggregateID).WithError(err).Warn("something went wrong in passwordAge policy handler") return spooler.HandleError(event, err, m.view.GetLatestPasswordAgePolicyFailedEvent, m.view.ProcessedPasswordAgePolicyFailedEvent, m.view.ProcessedPasswordAgePolicySequence, m.errorCountUntilSkip) } diff --git a/internal/management/repository/eventsourcing/handler/password_complexity_policy.go b/internal/management/repository/eventsourcing/handler/password_complexity_policy.go index d4935e88c5..9366ea1a38 100644 --- a/internal/management/repository/eventsourcing/handler/password_complexity_policy.go +++ b/internal/management/repository/eventsourcing/handler/password_complexity_policy.go @@ -2,11 +2,10 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -18,7 +17,7 @@ const ( type PasswordComplexityPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newPasswordComplexityPolicy(handler handler) *PasswordComplexityPolicy { @@ -56,7 +55,7 @@ func (p *PasswordComplexityPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *PasswordComplexityPolicy) EventQuery() (*models.SearchQuery, error) { +func (p *PasswordComplexityPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestPasswordComplexityPolicySequence() if err != nil { return nil, err @@ -66,7 +65,7 @@ func (p *PasswordComplexityPolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (p *PasswordComplexityPolicy) Reduce(event *models.Event) (err error) { +func (p *PasswordComplexityPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = p.processPasswordComplexityPolicy(event) @@ -74,7 +73,7 @@ func (p *PasswordComplexityPolicy) Reduce(event *models.Event) (err error) { return err } -func (p *PasswordComplexityPolicy) processPasswordComplexityPolicy(event *models.Event) (err error) { +func (p *PasswordComplexityPolicy) processPasswordComplexityPolicy(event *es_models.Event) (err error) { policy := new(iam_model.PasswordComplexityPolicyView) switch event.Type { case iam_es_model.PasswordComplexityPolicyAdded, model.PasswordComplexityPolicyAdded: @@ -96,7 +95,7 @@ func (p *PasswordComplexityPolicy) processPasswordComplexityPolicy(event *models return p.view.PutPasswordComplexityPolicy(policy, event) } -func (p *PasswordComplexityPolicy) OnError(event *models.Event, err error) error { +func (p *PasswordComplexityPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-4Djo9", "id", event.AggregateID).WithError(err).Warn("something went wrong in passwordComplexity policy handler") return spooler.HandleError(event, err, p.view.GetLatestPasswordComplexityPolicyFailedEvent, p.view.ProcessedPasswordComplexityPolicyFailedEvent, p.view.ProcessedPasswordComplexityPolicySequence, p.errorCountUntilSkip) } diff --git a/internal/management/repository/eventsourcing/handler/password_lockout_policy.go b/internal/management/repository/eventsourcing/handler/password_lockout_policy.go index 89103d6b84..a5ed4c7cd7 100644 --- a/internal/management/repository/eventsourcing/handler/password_lockout_policy.go +++ b/internal/management/repository/eventsourcing/handler/password_lockout_policy.go @@ -2,13 +2,12 @@ package handler import ( "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/repository/view/model" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) @@ -19,7 +18,7 @@ const ( type PasswordLockoutPolicy struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newPasswordLockoutPolicy(handler handler) *PasswordLockoutPolicy { @@ -57,7 +56,7 @@ func (p *PasswordLockoutPolicy) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *PasswordLockoutPolicy) EventQuery() (*models.SearchQuery, error) { +func (p *PasswordLockoutPolicy) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestPasswordLockoutPolicySequence() if err != nil { return nil, err @@ -67,7 +66,7 @@ func (p *PasswordLockoutPolicy) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (p *PasswordLockoutPolicy) Reduce(event *models.Event) (err error) { +func (p *PasswordLockoutPolicy) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case model.OrgAggregate, iam_es_model.IAMAggregate: err = p.processPasswordLockoutPolicy(event) @@ -75,7 +74,7 @@ func (p *PasswordLockoutPolicy) Reduce(event *models.Event) (err error) { return err } -func (p *PasswordLockoutPolicy) processPasswordLockoutPolicy(event *models.Event) (err error) { +func (p *PasswordLockoutPolicy) processPasswordLockoutPolicy(event *es_models.Event) (err error) { policy := new(iam_model.PasswordLockoutPolicyView) switch event.Type { case iam_es_model.PasswordLockoutPolicyAdded, model.PasswordLockoutPolicyAdded: @@ -97,7 +96,7 @@ func (p *PasswordLockoutPolicy) processPasswordLockoutPolicy(event *models.Event return p.view.PutPasswordLockoutPolicy(policy, event) } -func (p *PasswordLockoutPolicy) OnError(event *models.Event, err error) error { +func (p *PasswordLockoutPolicy) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-Bms8f", "id", event.AggregateID).WithError(err).Warn("something went wrong in passwordLockout policy handler") return spooler.HandleError(event, err, p.view.GetLatestPasswordLockoutPolicyFailedEvent, p.view.ProcessedPasswordLockoutPolicyFailedEvent, p.view.ProcessedPasswordLockoutPolicySequence, p.errorCountUntilSkip) } diff --git a/internal/management/repository/eventsourcing/handler/project.go b/internal/management/repository/eventsourcing/handler/project.go index 8c25315c07..a5355af288 100644 --- a/internal/management/repository/eventsourcing/handler/project.go +++ b/internal/management/repository/eventsourcing/handler/project.go @@ -2,11 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" proj_view "github.com/caos/zitadel/internal/project/repository/view" view_model "github.com/caos/zitadel/internal/project/repository/view/model" @@ -18,7 +18,7 @@ const ( type Project struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newProject(handler handler) *Project { diff --git a/internal/management/repository/eventsourcing/handler/project_grant.go b/internal/management/repository/eventsourcing/handler/project_grant.go index 88ed702791..7427937768 100644 --- a/internal/management/repository/eventsourcing/handler/project_grant.go +++ b/internal/management/repository/eventsourcing/handler/project_grant.go @@ -2,15 +2,15 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" org_model "github.com/caos/zitadel/internal/org/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" "github.com/caos/zitadel/internal/org/repository/view" @@ -26,7 +26,7 @@ const ( type ProjectGrant struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newProjectGrant( diff --git a/internal/management/repository/eventsourcing/handler/project_grant_member.go b/internal/management/repository/eventsourcing/handler/project_grant_member.go index 69bef0679a..23bfc5c0a5 100644 --- a/internal/management/repository/eventsourcing/handler/project_grant_member.go +++ b/internal/management/repository/eventsourcing/handler/project_grant_member.go @@ -3,16 +3,15 @@ package handler import ( "context" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/user/repository/view" usr_view_model "github.com/caos/zitadel/internal/user/repository/view/model" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" proj_es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" view_model "github.com/caos/zitadel/internal/project/repository/view/model" usr_model "github.com/caos/zitadel/internal/user/model" @@ -25,7 +24,7 @@ const ( type ProjectGrantMember struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newProjectGrantMember( @@ -65,7 +64,7 @@ func (p *ProjectGrantMember) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *ProjectGrantMember) EventQuery() (*models.SearchQuery, error) { +func (p *ProjectGrantMember) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestProjectGrantMemberSequence() if err != nil { return nil, err @@ -75,7 +74,7 @@ func (p *ProjectGrantMember) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (p *ProjectGrantMember) Reduce(event *models.Event) (err error) { +func (p *ProjectGrantMember) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case proj_es_model.ProjectAggregate: err = p.processProjectGrantMember(event) @@ -85,7 +84,7 @@ func (p *ProjectGrantMember) Reduce(event *models.Event) (err error) { return err } -func (p *ProjectGrantMember) processProjectGrantMember(event *models.Event) (err error) { +func (p *ProjectGrantMember) processProjectGrantMember(event *es_models.Event) (err error) { member := new(view_model.ProjectGrantMemberView) switch event.Type { case proj_es_model.ProjectGrantMemberAdded: @@ -125,7 +124,7 @@ func (p *ProjectGrantMember) processProjectGrantMember(event *models.Event) (err return p.view.PutProjectGrantMember(member, event) } -func (p *ProjectGrantMember) processUser(event *models.Event) (err error) { +func (p *ProjectGrantMember) processUser(event *es_models.Event) (err error) { switch event.Type { case usr_es_model.UserProfileChanged, usr_es_model.UserEmailChanged, @@ -174,7 +173,7 @@ func (p *ProjectGrantMember) fillUserData(member *view_model.ProjectGrantMemberV } } -func (p *ProjectGrantMember) OnError(event *models.Event, err error) error { +func (p *ProjectGrantMember) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-kls93", "id", event.AggregateID).WithError(err).Warn("something went wrong in projectmember handler") return spooler.HandleError(event, err, p.view.GetLatestProjectGrantMemberFailedEvent, p.view.ProcessedProjectGrantMemberFailedEvent, p.view.ProcessedProjectGrantMemberSequence, p.errorCountUntilSkip) } @@ -207,7 +206,7 @@ func (u *ProjectGrantMember) getUserByID(userID string) (*usr_view_model.UserVie return &userCopy, nil } -func (u *ProjectGrantMember) getUserEvents(userID string, sequence uint64) ([]*models.Event, error) { +func (u *ProjectGrantMember) getUserEvents(userID string, sequence uint64) ([]*es_models.Event, error) { query, err := view.UserByIDQuery(userID, sequence) if err != nil { return nil, err diff --git a/internal/management/repository/eventsourcing/handler/project_member.go b/internal/management/repository/eventsourcing/handler/project_member.go index e3cd29149e..1077814686 100644 --- a/internal/management/repository/eventsourcing/handler/project_member.go +++ b/internal/management/repository/eventsourcing/handler/project_member.go @@ -3,15 +3,14 @@ package handler import ( "context" caos_errs "github.com/caos/zitadel/internal/errors" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" proj_es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" view_model "github.com/caos/zitadel/internal/project/repository/view/model" usr_model "github.com/caos/zitadel/internal/user/model" @@ -25,7 +24,7 @@ const ( type ProjectMember struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newProjectMember( @@ -53,8 +52,8 @@ func (p *ProjectMember) ViewModel() string { return projectMemberTable } -func (_ *ProjectMember) AggregateTypes() []models.AggregateType { - return []models.AggregateType{proj_es_model.ProjectAggregate, usr_es_model.UserAggregate} +func (_ *ProjectMember) AggregateTypes() []es_models.AggregateType { + return []es_models.AggregateType{proj_es_model.ProjectAggregate, usr_es_model.UserAggregate} } func (p *ProjectMember) CurrentSequence() (uint64, error) { @@ -65,7 +64,7 @@ func (p *ProjectMember) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (p *ProjectMember) EventQuery() (*models.SearchQuery, error) { +func (p *ProjectMember) EventQuery() (*es_models.SearchQuery, error) { sequence, err := p.view.GetLatestProjectMemberSequence() if err != nil { return nil, err @@ -75,7 +74,7 @@ func (p *ProjectMember) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (p *ProjectMember) Reduce(event *models.Event) (err error) { +func (p *ProjectMember) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case proj_es_model.ProjectAggregate: err = p.processProjectMember(event) @@ -85,7 +84,7 @@ func (p *ProjectMember) Reduce(event *models.Event) (err error) { return err } -func (p *ProjectMember) processProjectMember(event *models.Event) (err error) { +func (p *ProjectMember) processProjectMember(event *es_models.Event) (err error) { member := new(view_model.ProjectMemberView) switch event.Type { case proj_es_model.ProjectMemberAdded: @@ -121,7 +120,7 @@ func (p *ProjectMember) processProjectMember(event *models.Event) (err error) { return p.view.PutProjectMember(member, event) } -func (p *ProjectMember) processUser(event *models.Event) (err error) { +func (p *ProjectMember) processUser(event *es_models.Event) (err error) { switch event.Type { case usr_es_model.UserProfileChanged, usr_es_model.UserEmailChanged, @@ -170,7 +169,7 @@ func (p *ProjectMember) fillUserData(member *view_model.ProjectMemberView, user member.DisplayName = user.MachineView.Name } } -func (p *ProjectMember) OnError(event *models.Event, err error) error { +func (p *ProjectMember) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-u73es", "id", event.AggregateID).WithError(err).Warn("something went wrong in projectmember handler") return spooler.HandleError(event, err, p.view.GetLatestProjectMemberFailedEvent, p.view.ProcessedProjectMemberFailedEvent, p.view.ProcessedProjectMemberSequence, p.errorCountUntilSkip) } @@ -203,7 +202,7 @@ func (u *ProjectMember) getUserByID(userID string) (*usr_view_model.UserView, er return &userCopy, nil } -func (u *ProjectMember) getUserEvents(userID string, sequence uint64) ([]*models.Event, error) { +func (u *ProjectMember) getUserEvents(userID string, sequence uint64) ([]*es_models.Event, error) { query, err := view.UserByIDQuery(userID, sequence) if err != nil { return nil, err diff --git a/internal/management/repository/eventsourcing/handler/project_role.go b/internal/management/repository/eventsourcing/handler/project_role.go index 6945bae3c8..a067e3d43a 100644 --- a/internal/management/repository/eventsourcing/handler/project_role.go +++ b/internal/management/repository/eventsourcing/handler/project_role.go @@ -2,11 +2,11 @@ package handler import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" proj_view "github.com/caos/zitadel/internal/project/repository/view" view_model "github.com/caos/zitadel/internal/project/repository/view/model" @@ -18,7 +18,7 @@ const ( type ProjectRole struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newProjectRole( diff --git a/internal/management/repository/eventsourcing/handler/user.go b/internal/management/repository/eventsourcing/handler/user.go index 5e1269dc39..fdfc2a714d 100644 --- a/internal/management/repository/eventsourcing/handler/user.go +++ b/internal/management/repository/eventsourcing/handler/user.go @@ -3,13 +3,13 @@ package handler import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" @@ -18,7 +18,6 @@ import ( "github.com/caos/zitadel/internal/org/repository/view" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" view_model "github.com/caos/zitadel/internal/user/repository/view/model" - "github.com/caos/zitadel/internal/v2/domain" ) const ( @@ -28,7 +27,7 @@ const ( type User struct { handler iamID string - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUser( @@ -70,7 +69,7 @@ func (u *User) CurrentSequence() (uint64, error) { return sequence.CurrentSequence, nil } -func (u *User) EventQuery() (*models.SearchQuery, error) { +func (u *User) EventQuery() (*es_models.SearchQuery, error) { sequence, err := u.view.GetLatestUserSequence() if err != nil { return nil, err @@ -80,7 +79,7 @@ func (u *User) EventQuery() (*models.SearchQuery, error) { LatestSequenceFilter(sequence.CurrentSequence), nil } -func (u *User) Reduce(event *models.Event) (err error) { +func (u *User) Reduce(event *es_models.Event) (err error) { switch event.AggregateType { case es_model.UserAggregate: return u.ProcessUser(event) @@ -91,7 +90,7 @@ func (u *User) Reduce(event *models.Event) (err error) { } } -func (u *User) ProcessUser(event *models.Event) (err error) { +func (u *User) ProcessUser(event *es_models.Event) (err error) { user := new(view_model.UserView) switch event.Type { case es_model.UserAdded, @@ -162,7 +161,7 @@ func (u *User) ProcessUser(event *models.Event) (err error) { return u.view.PutUser(user, event) } -func (u *User) ProcessOrg(event *models.Event) (err error) { +func (u *User) ProcessOrg(event *es_models.Event) (err error) { switch event.Type { case org_es_model.OrgDomainVerified, org_es_model.OrgDomainRemoved, @@ -177,7 +176,7 @@ func (u *User) ProcessOrg(event *models.Event) (err error) { } } -func (u *User) fillLoginNamesOnOrgUsers(event *models.Event) error { +func (u *User) fillLoginNamesOnOrgUsers(event *es_models.Event) error { org, err := u.getOrgByID(context.Background(), event.ResourceOwner) if err != nil { return err @@ -199,7 +198,7 @@ func (u *User) fillLoginNamesOnOrgUsers(event *models.Event) error { return u.view.PutUsers(users, event) } -func (u *User) fillPreferredLoginNamesOnOrgUsers(event *models.Event) error { +func (u *User) fillPreferredLoginNamesOnOrgUsers(event *es_models.Event) error { org, err := u.getOrgByID(context.Background(), event.ResourceOwner) if err != nil { return err @@ -241,7 +240,7 @@ func (u *User) fillLoginNames(user *view_model.UserView) (err error) { return nil } -func (u *User) OnError(event *models.Event, err error) error { +func (u *User) OnError(event *es_models.Event, err error) error { logging.LogWithFields("SPOOL-is8wa", "id", event.AggregateID).WithError(err).Warn("something went wrong in user handler") return spooler.HandleError(event, err, u.view.GetLatestUserFailedEvent, u.view.ProcessedUserFailedEvent, u.view.ProcessedUserSequence, u.errorCountUntilSkip) } @@ -257,7 +256,7 @@ func (u *User) getOrgByID(ctx context.Context, orgID string) (*org_model.Org, er } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } @@ -278,7 +277,7 @@ func (u *User) getIAMByID(ctx context.Context) (*iam_model.IAM, error) { return nil, err } iam := &model.IAM{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: domain.IAMID, }, } diff --git a/internal/management/repository/eventsourcing/handler/user_external_idps.go b/internal/management/repository/eventsourcing/handler/user_external_idps.go index acbb804f26..14f10f680d 100644 --- a/internal/management/repository/eventsourcing/handler/user_external_idps.go +++ b/internal/management/repository/eventsourcing/handler/user_external_idps.go @@ -2,20 +2,20 @@ package handler import ( "context" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/v1" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_view "github.com/caos/zitadel/internal/iam/repository/view" org_model "github.com/caos/zitadel/internal/org/model" "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/logging" "github.com/caos/zitadel/internal/config/systemdefaults" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -31,7 +31,7 @@ const ( type ExternalIDP struct { handler systemDefaults systemdefaults.SystemDefaults - subscription *eventstore.Subscription + subscription *v1.Subscription } func newExternalIDP( diff --git a/internal/management/repository/eventsourcing/handler/user_grant.go b/internal/management/repository/eventsourcing/handler/user_grant.go index 7043d32309..f2fda5289b 100644 --- a/internal/management/repository/eventsourcing/handler/user_grant.go +++ b/internal/management/repository/eventsourcing/handler/user_grant.go @@ -2,23 +2,22 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/logging" "k8s.io/apimachinery/pkg/api/errors" caos_errs "github.com/caos/zitadel/internal/errors" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" org_view "github.com/caos/zitadel/internal/org/repository/view" proj_view "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/user/repository/view" usr_view_model "github.com/caos/zitadel/internal/user/repository/view/model" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" org_model "github.com/caos/zitadel/internal/org/model" proj_model "github.com/caos/zitadel/internal/project/model" proj_es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" @@ -34,7 +33,7 @@ const ( type UserGrant struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUserGrant( @@ -256,7 +255,7 @@ func (u *UserGrant) getUserByID(userID string) (*usr_view_model.UserView, error) return &userCopy, nil } -func (u *UserGrant) getUserEvents(userID string, sequence uint64) ([]*models.Event, error) { +func (u *UserGrant) getUserEvents(userID string, sequence uint64) ([]*es_models.Event, error) { query, err := view.UserByIDQuery(userID, sequence) if err != nil { return nil, err @@ -272,7 +271,7 @@ func (u *UserGrant) getOrgByID(ctx context.Context, orgID string) (*org_model.Or } esOrg := &org_es_model.Org{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: orgID, }, } @@ -293,7 +292,7 @@ func (u *UserGrant) getProjectByID(ctx context.Context, projID string) (*proj_mo return nil, err } esProject := &proj_es_model.Project{ - ObjectRoot: models.ObjectRoot{ + ObjectRoot: es_models.ObjectRoot{ AggregateID: projID, }, } diff --git a/internal/management/repository/eventsourcing/handler/user_membership.go b/internal/management/repository/eventsourcing/handler/user_membership.go index 4716d158fc..3e7309ea71 100644 --- a/internal/management/repository/eventsourcing/handler/user_membership.go +++ b/internal/management/repository/eventsourcing/handler/user_membership.go @@ -2,21 +2,21 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/eventstore/v1" "k8s.io/apimachinery/pkg/api/errors" caos_errs "github.com/caos/zitadel/internal/errors" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" org_view "github.com/caos/zitadel/internal/org/repository/view" proj_model "github.com/caos/zitadel/internal/project/model" proj_view "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" org_model "github.com/caos/zitadel/internal/org/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" @@ -32,7 +32,7 @@ const ( type UserMembership struct { handler - subscription *eventstore.Subscription + subscription *v1.Subscription } func newUserMembership( diff --git a/internal/management/repository/eventsourcing/repository.go b/internal/management/repository/eventsourcing/repository.go index c989f55858..79f21886ef 100644 --- a/internal/management/repository/eventsourcing/repository.go +++ b/internal/management/repository/eventsourcing/repository.go @@ -1,12 +1,12 @@ package eventsourcing import ( - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/eventstore/v1" + "github.com/caos/zitadel/internal/query" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/config/types" - es_int "github.com/caos/zitadel/internal/eventstore" - es_spol "github.com/caos/zitadel/internal/eventstore/spooler" + es_spol "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/management/repository/eventsourcing/eventstore" "github.com/caos/zitadel/internal/management/repository/eventsourcing/spooler" mgmt_view "github.com/caos/zitadel/internal/management/repository/eventsourcing/view" @@ -15,7 +15,7 @@ import ( type Config struct { SearchLimit uint64 Domain string - Eventstore es_int.Config + Eventstore v1.Config View types.SQL Spooler spooler.SpoolerConfig } @@ -32,7 +32,7 @@ type EsRepository struct { func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string) (*EsRepository, error) { - es, err := es_int.Start(conf.Eventstore) + es, err := v1.Start(conf.Eventstore) if err != nil { return nil, err } diff --git a/internal/management/repository/eventsourcing/spooler/lock.go b/internal/management/repository/eventsourcing/spooler/lock.go index f24f98f6cc..62e543a86f 100644 --- a/internal/management/repository/eventsourcing/spooler/lock.go +++ b/internal/management/repository/eventsourcing/spooler/lock.go @@ -2,7 +2,7 @@ package spooler import ( "database/sql" - es_locker "github.com/caos/zitadel/internal/eventstore/locker" + es_locker "github.com/caos/zitadel/internal/eventstore/v1/locker" "time" ) diff --git a/internal/management/repository/eventsourcing/spooler/spooler.go b/internal/management/repository/eventsourcing/spooler/spooler.go index 8954b5f170..84a6b6f2a0 100644 --- a/internal/management/repository/eventsourcing/spooler/spooler.go +++ b/internal/management/repository/eventsourcing/spooler/spooler.go @@ -3,9 +3,9 @@ package spooler import ( "database/sql" "github.com/caos/zitadel/internal/config/systemdefaults" + "github.com/caos/zitadel/internal/eventstore/v1" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/management/repository/eventsourcing/handler" "github.com/caos/zitadel/internal/management/repository/eventsourcing/view" ) @@ -17,7 +17,7 @@ type SpoolerConfig struct { Handlers handler.Configs } -func StartSpooler(c SpoolerConfig, es eventstore.Eventstore, view *view.View, sql *sql.DB, defaults systemdefaults.SystemDefaults) *spooler.Spooler { +func StartSpooler(c SpoolerConfig, es v1.Eventstore, view *view.View, sql *sql.DB, defaults systemdefaults.SystemDefaults) *spooler.Spooler { spoolerConfig := spooler.Config{ Eventstore: es, Locker: &locker{dbClient: sql}, diff --git a/internal/management/repository/eventsourcing/view/application.go b/internal/management/repository/eventsourcing/view/application.go index 45a5f344ac..0508b4a59b 100644 --- a/internal/management/repository/eventsourcing/view/application.go +++ b/internal/management/repository/eventsourcing/view/application.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/authn_keys.go b/internal/management/repository/eventsourcing/view/authn_keys.go index cc982dc4c7..720baf6bde 100644 --- a/internal/management/repository/eventsourcing/view/authn_keys.go +++ b/internal/management/repository/eventsourcing/view/authn_keys.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" key_model "github.com/caos/zitadel/internal/key/model" "github.com/caos/zitadel/internal/key/repository/view" "github.com/caos/zitadel/internal/key/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/external_idps.go b/internal/management/repository/eventsourcing/view/external_idps.go index 74c1f48f47..96c05c44c0 100644 --- a/internal/management/repository/eventsourcing/view/external_idps.go +++ b/internal/management/repository/eventsourcing/view/external_idps.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/idp_configs.go b/internal/management/repository/eventsourcing/view/idp_configs.go index ca759c6f38..f857124a8a 100644 --- a/internal/management/repository/eventsourcing/view/idp_configs.go +++ b/internal/management/repository/eventsourcing/view/idp_configs.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/view" iam_es_model "github.com/caos/zitadel/internal/iam/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/idp_providers.go b/internal/management/repository/eventsourcing/view/idp_providers.go index f73a4720f8..1a9ba11889 100644 --- a/internal/management/repository/eventsourcing/view/idp_providers.go +++ b/internal/management/repository/eventsourcing/view/idp_providers.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/label_policies.go b/internal/management/repository/eventsourcing/view/label_policies.go index 17cb603d25..92489ded89 100644 --- a/internal/management/repository/eventsourcing/view/label_policies.go +++ b/internal/management/repository/eventsourcing/view/label_policies.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/login_policies.go b/internal/management/repository/eventsourcing/view/login_policies.go index 6ce2ee91bb..18647af083 100644 --- a/internal/management/repository/eventsourcing/view/login_policies.go +++ b/internal/management/repository/eventsourcing/view/login_policies.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/mail_templates.go b/internal/management/repository/eventsourcing/view/mail_templates.go index 34c3ab2249..3368d10ade 100644 --- a/internal/management/repository/eventsourcing/view/mail_templates.go +++ b/internal/management/repository/eventsourcing/view/mail_templates.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/mail_texts.go b/internal/management/repository/eventsourcing/view/mail_texts.go index c9ab7cd443..7cae1a41d3 100644 --- a/internal/management/repository/eventsourcing/view/mail_texts.go +++ b/internal/management/repository/eventsourcing/view/mail_texts.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/org.go b/internal/management/repository/eventsourcing/view/org.go index 72323eeb07..5e45712351 100644 --- a/internal/management/repository/eventsourcing/view/org.go +++ b/internal/management/repository/eventsourcing/view/org.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" org_view "github.com/caos/zitadel/internal/org/repository/view" "github.com/caos/zitadel/internal/org/repository/view/model" "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/org_domain.go b/internal/management/repository/eventsourcing/view/org_domain.go index 6819980dea..7dde72eb96 100644 --- a/internal/management/repository/eventsourcing/view/org_domain.go +++ b/internal/management/repository/eventsourcing/view/org_domain.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" org_model "github.com/caos/zitadel/internal/org/model" "github.com/caos/zitadel/internal/org/repository/view" "github.com/caos/zitadel/internal/org/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/org_iam_policy.go b/internal/management/repository/eventsourcing/view/org_iam_policy.go index 266c2e0371..3d0409d486 100644 --- a/internal/management/repository/eventsourcing/view/org_iam_policy.go +++ b/internal/management/repository/eventsourcing/view/org_iam_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/org_member.go b/internal/management/repository/eventsourcing/view/org_member.go index 0f69399786..3a9f522a66 100644 --- a/internal/management/repository/eventsourcing/view/org_member.go +++ b/internal/management/repository/eventsourcing/view/org_member.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" org_model "github.com/caos/zitadel/internal/org/model" "github.com/caos/zitadel/internal/org/repository/view" "github.com/caos/zitadel/internal/org/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/password_age_policy.go b/internal/management/repository/eventsourcing/view/password_age_policy.go index 5fc99367cf..9b74ae1e98 100644 --- a/internal/management/repository/eventsourcing/view/password_age_policy.go +++ b/internal/management/repository/eventsourcing/view/password_age_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/password_complexity_policy.go b/internal/management/repository/eventsourcing/view/password_complexity_policy.go index db24d4ab2a..6ad566b5cc 100644 --- a/internal/management/repository/eventsourcing/view/password_complexity_policy.go +++ b/internal/management/repository/eventsourcing/view/password_complexity_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/password_lockout_policy.go b/internal/management/repository/eventsourcing/view/password_lockout_policy.go index d3e0ea0e16..8941447b77 100644 --- a/internal/management/repository/eventsourcing/view/password_lockout_policy.go +++ b/internal/management/repository/eventsourcing/view/password_lockout_policy.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/repository/view" "github.com/caos/zitadel/internal/iam/repository/view/model" global_view "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/management/repository/eventsourcing/view/project.go b/internal/management/repository/eventsourcing/view/project.go index d32f7c577d..ef5ebd8967 100644 --- a/internal/management/repository/eventsourcing/view/project.go +++ b/internal/management/repository/eventsourcing/view/project.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/project_grant.go b/internal/management/repository/eventsourcing/view/project_grant.go index 08eb4bf444..1630d09080 100644 --- a/internal/management/repository/eventsourcing/view/project_grant.go +++ b/internal/management/repository/eventsourcing/view/project_grant.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/project_grant_member.go b/internal/management/repository/eventsourcing/view/project_grant_member.go index e682ef25da..263cd51a28 100644 --- a/internal/management/repository/eventsourcing/view/project_grant_member.go +++ b/internal/management/repository/eventsourcing/view/project_grant_member.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/project_member.go b/internal/management/repository/eventsourcing/view/project_member.go index 327632c789..97de82dcd1 100644 --- a/internal/management/repository/eventsourcing/view/project_member.go +++ b/internal/management/repository/eventsourcing/view/project_member.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/project_role.go b/internal/management/repository/eventsourcing/view/project_role.go index 68da7611fd..99458aa81c 100644 --- a/internal/management/repository/eventsourcing/view/project_role.go +++ b/internal/management/repository/eventsourcing/view/project_role.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/sequence.go b/internal/management/repository/eventsourcing/view/sequence.go index 4cff5fc9eb..047d8db560 100644 --- a/internal/management/repository/eventsourcing/view/sequence.go +++ b/internal/management/repository/eventsourcing/view/sequence.go @@ -3,7 +3,7 @@ package view import ( "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/view/repository" ) diff --git a/internal/management/repository/eventsourcing/view/user.go b/internal/management/repository/eventsourcing/view/user.go index 8622d7a381..ed10966d2f 100644 --- a/internal/management/repository/eventsourcing/view/user.go +++ b/internal/management/repository/eventsourcing/view/user.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/user_grant.go b/internal/management/repository/eventsourcing/view/user_grant.go index 6a34a8ee78..6e012a4d88 100644 --- a/internal/management/repository/eventsourcing/view/user_grant.go +++ b/internal/management/repository/eventsourcing/view/user_grant.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" grant_model "github.com/caos/zitadel/internal/usergrant/model" "github.com/caos/zitadel/internal/usergrant/repository/view" "github.com/caos/zitadel/internal/usergrant/repository/view/model" diff --git a/internal/management/repository/eventsourcing/view/user_membership.go b/internal/management/repository/eventsourcing/view/user_membership.go index 0187cd62bc..dd1f39d2ba 100644 --- a/internal/management/repository/eventsourcing/view/user_membership.go +++ b/internal/management/repository/eventsourcing/view/user_membership.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" diff --git a/internal/notification/notification.go b/internal/notification/notification.go index 3fe5a8c947..f8cd714c73 100644 --- a/internal/notification/notification.go +++ b/internal/notification/notification.go @@ -3,9 +3,9 @@ package notification import ( "context" "github.com/caos/logging" + "github.com/caos/zitadel/internal/command" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/notification/repository/eventsourcing" - "github.com/caos/zitadel/internal/v2/command" "github.com/rakyll/statik/fs" _ "github.com/caos/zitadel/internal/notification/statik" diff --git a/internal/notification/repository/eventsourcing/handler/handler.go b/internal/notification/repository/eventsourcing/handler/handler.go index eb3affa5c2..7d3d7c41b0 100644 --- a/internal/notification/repository/eventsourcing/handler/handler.go +++ b/internal/notification/repository/eventsourcing/handler/handler.go @@ -1,7 +1,8 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/command" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/eventstore/v1" "net/http" "time" @@ -9,8 +10,7 @@ import ( sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/config/types" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/query" + "github.com/caos/zitadel/internal/eventstore/v1/query" "github.com/caos/zitadel/internal/i18n" "github.com/caos/zitadel/internal/notification/repository/eventsourcing/view" ) @@ -27,14 +27,14 @@ type handler struct { cycleDuration time.Duration errorCountUntilSkip uint64 - es eventstore.Eventstore + es v1.Eventstore } -func (h *handler) Eventstore() eventstore.Eventstore { +func (h *handler) Eventstore() v1.Eventstore { return h.es } -func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es eventstore.Eventstore, command *command.CommandSide, systemDefaults sd.SystemDefaults, i18n *i18n.Translator, dir http.FileSystem) []query.Handler { +func Register(configs Configs, bulkLimit, errorCount uint64, view *view.View, es v1.Eventstore, command *command.CommandSide, systemDefaults sd.SystemDefaults, i18n *i18n.Translator, dir http.FileSystem) []query.Handler { aesCrypto, err := crypto.NewAESCrypto(systemDefaults.UserVerificationKey) if err != nil { logging.Log("HANDL-s90ew").WithError(err).Debug("error create new aes crypto") diff --git a/internal/notification/repository/eventsourcing/handler/notification.go b/internal/notification/repository/eventsourcing/handler/notification.go index 266e056f96..d6d767bc00 100644 --- a/internal/notification/repository/eventsourcing/handler/notification.go +++ b/internal/notification/repository/eventsourcing/handler/notification.go @@ -3,10 +3,11 @@ package handler import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/eventstore/v1" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" view_model "github.com/caos/zitadel/internal/user/repository/view/model" - "github.com/caos/zitadel/internal/v2/command" "golang.org/x/text/language" "net/http" "time" @@ -17,10 +18,9 @@ import ( "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/i18n" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/view/model" @@ -51,7 +51,7 @@ type Notification struct { AesCrypto crypto.EncryptionAlgorithm i18n *i18n.Translator statikDir http.FileSystem - subscription *eventstore.Subscription + subscription *v1.Subscription } func newNotification( diff --git a/internal/notification/repository/eventsourcing/handler/notify_user.go b/internal/notification/repository/eventsourcing/handler/notify_user.go index 90ef1a3daa..48ca62b6aa 100644 --- a/internal/notification/repository/eventsourcing/handler/notify_user.go +++ b/internal/notification/repository/eventsourcing/handler/notify_user.go @@ -2,19 +2,19 @@ package handler import ( "context" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + "github.com/caos/zitadel/internal/eventstore/v1" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" iam_view "github.com/caos/zitadel/internal/iam/repository/view" org_view "github.com/caos/zitadel/internal/org/repository/view" - "github.com/caos/zitadel/internal/v2/domain" "github.com/caos/logging" - "github.com/caos/zitadel/internal/eventstore" - es_models "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/query" - "github.com/caos/zitadel/internal/eventstore/spooler" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + "github.com/caos/zitadel/internal/eventstore/v1/query" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" org_model "github.com/caos/zitadel/internal/org/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" @@ -28,7 +28,7 @@ const ( type NotifyUser struct { handler iamID string - subscription *eventstore.Subscription + subscription *v1.Subscription } func newNotifyUser( diff --git a/internal/notification/repository/eventsourcing/repository.go b/internal/notification/repository/eventsourcing/repository.go index afd09bc2a9..772015b17f 100644 --- a/internal/notification/repository/eventsourcing/repository.go +++ b/internal/notification/repository/eventsourcing/repository.go @@ -1,13 +1,13 @@ package eventsourcing import ( - "github.com/caos/zitadel/internal/v2/command" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/eventstore/v1" "net/http" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/config/types" - es_int "github.com/caos/zitadel/internal/eventstore" - es_spol "github.com/caos/zitadel/internal/eventstore/spooler" + es_spol "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/i18n" "github.com/caos/zitadel/internal/notification/repository/eventsourcing/spooler" noti_view "github.com/caos/zitadel/internal/notification/repository/eventsourcing/view" @@ -16,7 +16,7 @@ import ( type Config struct { DefaultLanguage language.Tag - Eventstore es_int.Config + Eventstore v1.Config View types.SQL Spooler spooler.SpoolerConfig Domain string @@ -27,7 +27,7 @@ type EsRepository struct { } func Start(conf Config, dir http.FileSystem, systemDefaults sd.SystemDefaults, command *command.CommandSide) (*EsRepository, error) { - es, err := es_int.Start(conf.Eventstore) + es, err := v1.Start(conf.Eventstore) if err != nil { return nil, err } diff --git a/internal/notification/repository/eventsourcing/spooler/lock.go b/internal/notification/repository/eventsourcing/spooler/lock.go index 46325b1495..c368737ca9 100644 --- a/internal/notification/repository/eventsourcing/spooler/lock.go +++ b/internal/notification/repository/eventsourcing/spooler/lock.go @@ -2,7 +2,7 @@ package spooler import ( "database/sql" - es_locker "github.com/caos/zitadel/internal/eventstore/locker" + es_locker "github.com/caos/zitadel/internal/eventstore/v1/locker" "time" ) diff --git a/internal/notification/repository/eventsourcing/spooler/spooler.go b/internal/notification/repository/eventsourcing/spooler/spooler.go index 01d64e5afa..3cb7ebf41d 100644 --- a/internal/notification/repository/eventsourcing/spooler/spooler.go +++ b/internal/notification/repository/eventsourcing/spooler/spooler.go @@ -2,12 +2,12 @@ package spooler import ( "database/sql" - "github.com/caos/zitadel/internal/v2/command" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/eventstore/v1" "net/http" sd "github.com/caos/zitadel/internal/config/systemdefaults" - "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/spooler" + "github.com/caos/zitadel/internal/eventstore/v1/spooler" "github.com/caos/zitadel/internal/i18n" "github.com/caos/zitadel/internal/notification/repository/eventsourcing/handler" "github.com/caos/zitadel/internal/notification/repository/eventsourcing/view" @@ -20,7 +20,7 @@ type SpoolerConfig struct { Handlers handler.Configs } -func StartSpooler(c SpoolerConfig, es eventstore.Eventstore, view *view.View, sql *sql.DB, command *command.CommandSide, systemDefaults sd.SystemDefaults, i18n *i18n.Translator, dir http.FileSystem) *spooler.Spooler { +func StartSpooler(c SpoolerConfig, es v1.Eventstore, view *view.View, sql *sql.DB, command *command.CommandSide, systemDefaults sd.SystemDefaults, i18n *i18n.Translator, dir http.FileSystem) *spooler.Spooler { spoolerConfig := spooler.Config{ Eventstore: es, Locker: &locker{dbClient: sql}, diff --git a/internal/notification/repository/eventsourcing/view/notification.go b/internal/notification/repository/eventsourcing/view/notification.go index fc7041bbab..ebfef66bfe 100644 --- a/internal/notification/repository/eventsourcing/view/notification.go +++ b/internal/notification/repository/eventsourcing/view/notification.go @@ -1,7 +1,7 @@ package view import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/view/repository" ) diff --git a/internal/notification/repository/eventsourcing/view/notify_user.go b/internal/notification/repository/eventsourcing/view/notify_user.go index b3b3397f77..99d9516a66 100644 --- a/internal/notification/repository/eventsourcing/view/notify_user.go +++ b/internal/notification/repository/eventsourcing/view/notify_user.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/repository/view" "github.com/caos/zitadel/internal/user/repository/view/model" "github.com/caos/zitadel/internal/view/repository" diff --git a/internal/notification/repository/eventsourcing/view/sequence.go b/internal/notification/repository/eventsourcing/view/sequence.go index d7155c6292..17d8fe9b55 100644 --- a/internal/notification/repository/eventsourcing/view/sequence.go +++ b/internal/notification/repository/eventsourcing/view/sequence.go @@ -3,7 +3,7 @@ package view import ( "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/view/repository" ) diff --git a/internal/org/model/domain.go b/internal/org/model/domain.go index f3da2ba432..93d319bf0b 100644 --- a/internal/org/model/domain.go +++ b/internal/org/model/domain.go @@ -3,7 +3,7 @@ package model import ( http_util "github.com/caos/zitadel/internal/api/http" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type OrgDomain struct { diff --git a/internal/org/model/member.go b/internal/org/model/member.go index 5be1f50343..b058ae2f07 100644 --- a/internal/org/model/member.go +++ b/internal/org/model/member.go @@ -1,6 +1,6 @@ package model -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type OrgMember struct { es_models.ObjectRoot diff --git a/internal/org/model/org.go b/internal/org/model/org.go index 6ae649acd4..9d1e4ba06f 100644 --- a/internal/org/model/org.go +++ b/internal/org/model/org.go @@ -3,7 +3,7 @@ package model import ( "strings" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/golang/protobuf/ptypes/timestamp" ) diff --git a/internal/org/model/org_view.go b/internal/org/model/org_view.go index a70bfb4e53..216c023347 100644 --- a/internal/org/model/org_view.go +++ b/internal/org/model/org_view.go @@ -3,7 +3,7 @@ package model import ( "time" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/model" ) diff --git a/internal/org/repository/eventsourcing/model/domain.go b/internal/org/repository/eventsourcing/model/domain.go index 0f2e83b1b6..55284611e8 100644 --- a/internal/org/repository/eventsourcing/model/domain.go +++ b/internal/org/repository/eventsourcing/model/domain.go @@ -5,7 +5,7 @@ import ( "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/org/model" ) diff --git a/internal/org/repository/eventsourcing/model/idp_config.go b/internal/org/repository/eventsourcing/model/idp_config.go index d1326f3d41..a09582cebe 100644 --- a/internal/org/repository/eventsourcing/model/idp_config.go +++ b/internal/org/repository/eventsourcing/model/idp_config.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/idp_config_test.go b/internal/org/repository/eventsourcing/model/idp_config_test.go index affe1060de..5908292b2f 100644 --- a/internal/org/repository/eventsourcing/model/idp_config_test.go +++ b/internal/org/repository/eventsourcing/model/idp_config_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" "testing" diff --git a/internal/org/repository/eventsourcing/model/label_policy.go b/internal/org/repository/eventsourcing/model/label_policy.go index 13b281dd0f..e8bdc41423 100644 --- a/internal/org/repository/eventsourcing/model/label_policy.go +++ b/internal/org/repository/eventsourcing/model/label_policy.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/label_policy_test.go b/internal/org/repository/eventsourcing/model/label_policy_test.go index 819d76996a..b482e5e4e9 100644 --- a/internal/org/repository/eventsourcing/model/label_policy_test.go +++ b/internal/org/repository/eventsourcing/model/label_policy_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/login_policy.go b/internal/org/repository/eventsourcing/model/login_policy.go index 02388669f8..a9b67ceded 100644 --- a/internal/org/repository/eventsourcing/model/login_policy.go +++ b/internal/org/repository/eventsourcing/model/login_policy.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/login_policy_test.go b/internal/org/repository/eventsourcing/model/login_policy_test.go index 2662cb0910..978cc57e04 100644 --- a/internal/org/repository/eventsourcing/model/login_policy_test.go +++ b/internal/org/repository/eventsourcing/model/login_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" "testing" diff --git a/internal/org/repository/eventsourcing/model/mail_template.go b/internal/org/repository/eventsourcing/model/mail_template.go index 4a0f4aff5d..1ff9fc358a 100644 --- a/internal/org/repository/eventsourcing/model/mail_template.go +++ b/internal/org/repository/eventsourcing/model/mail_template.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/mail_template_test.go b/internal/org/repository/eventsourcing/model/mail_template_test.go index 2ec769de01..60042afc73 100644 --- a/internal/org/repository/eventsourcing/model/mail_template_test.go +++ b/internal/org/repository/eventsourcing/model/mail_template_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/mail_text.go b/internal/org/repository/eventsourcing/model/mail_text.go index 964cb2dea9..908228b364 100644 --- a/internal/org/repository/eventsourcing/model/mail_text.go +++ b/internal/org/repository/eventsourcing/model/mail_text.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/mail_text_test.go b/internal/org/repository/eventsourcing/model/mail_text_test.go index 640914ad82..49de9b3d6f 100644 --- a/internal/org/repository/eventsourcing/model/mail_text_test.go +++ b/internal/org/repository/eventsourcing/model/mail_text_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/member.go b/internal/org/repository/eventsourcing/model/member.go index 2390d66a97..b4cb2ab9f1 100644 --- a/internal/org/repository/eventsourcing/model/member.go +++ b/internal/org/repository/eventsourcing/model/member.go @@ -5,7 +5,7 @@ import ( "reflect" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/org/model" ) diff --git a/internal/org/repository/eventsourcing/model/org.go b/internal/org/repository/eventsourcing/model/org.go index 1998292639..86e89188a5 100644 --- a/internal/org/repository/eventsourcing/model/org.go +++ b/internal/org/repository/eventsourcing/model/org.go @@ -7,7 +7,7 @@ import ( iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" org_model "github.com/caos/zitadel/internal/org/model" ) diff --git a/internal/org/repository/eventsourcing/model/org_iam_policy.go b/internal/org/repository/eventsourcing/model/org_iam_policy.go index f7b6241426..40c9d3acc9 100644 --- a/internal/org/repository/eventsourcing/model/org_iam_policy.go +++ b/internal/org/repository/eventsourcing/model/org_iam_policy.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/org_test.go b/internal/org/repository/eventsourcing/model/org_test.go index 07dd9c75f4..34bb6c51ee 100644 --- a/internal/org/repository/eventsourcing/model/org_test.go +++ b/internal/org/repository/eventsourcing/model/org_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/org/model" ) diff --git a/internal/org/repository/eventsourcing/model/password_age_policy.go b/internal/org/repository/eventsourcing/model/password_age_policy.go index 09ddb64529..5b9894bbc6 100644 --- a/internal/org/repository/eventsourcing/model/password_age_policy.go +++ b/internal/org/repository/eventsourcing/model/password_age_policy.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/password_age_policy_test.go b/internal/org/repository/eventsourcing/model/password_age_policy_test.go index 34e03ad092..75149359d4 100644 --- a/internal/org/repository/eventsourcing/model/password_age_policy_test.go +++ b/internal/org/repository/eventsourcing/model/password_age_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" "testing" ) diff --git a/internal/org/repository/eventsourcing/model/password_complexity_policy.go b/internal/org/repository/eventsourcing/model/password_complexity_policy.go index be9e769a1e..103da54b58 100644 --- a/internal/org/repository/eventsourcing/model/password_complexity_policy.go +++ b/internal/org/repository/eventsourcing/model/password_complexity_policy.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/password_complexity_policy_test.go b/internal/org/repository/eventsourcing/model/password_complexity_policy_test.go index 85417bfe36..1bd1eb5604 100644 --- a/internal/org/repository/eventsourcing/model/password_complexity_policy_test.go +++ b/internal/org/repository/eventsourcing/model/password_complexity_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" "testing" ) diff --git a/internal/org/repository/eventsourcing/model/password_lockout_policy.go b/internal/org/repository/eventsourcing/model/password_lockout_policy.go index 9aa5efd33f..6501aef1b9 100644 --- a/internal/org/repository/eventsourcing/model/password_lockout_policy.go +++ b/internal/org/repository/eventsourcing/model/password_lockout_policy.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" ) diff --git a/internal/org/repository/eventsourcing/model/password_lockout_policy_test.go b/internal/org/repository/eventsourcing/model/password_lockout_policy_test.go index 7efdf2955f..e6057d879a 100644 --- a/internal/org/repository/eventsourcing/model/password_lockout_policy_test.go +++ b/internal/org/repository/eventsourcing/model/password_lockout_policy_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" "testing" ) diff --git a/internal/org/repository/eventsourcing/model/types.go b/internal/org/repository/eventsourcing/model/types.go index 0f21da6749..c01cd84ea3 100644 --- a/internal/org/repository/eventsourcing/model/types.go +++ b/internal/org/repository/eventsourcing/model/types.go @@ -1,6 +1,6 @@ package model -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" const ( OrgAggregate models.AggregateType = "org" diff --git a/internal/org/repository/view/model/org.go b/internal/org/repository/view/model/org.go index c9db56f63d..4ee4f0aac5 100644 --- a/internal/org/repository/view/model/org.go +++ b/internal/org/repository/view/model/org.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" org_model "github.com/caos/zitadel/internal/org/model" ) diff --git a/internal/org/repository/view/model/org_domain.go b/internal/org/repository/view/model/org_domain.go index 0d0df43e7a..0ddf2e3d5c 100644 --- a/internal/org/repository/view/model/org_domain.go +++ b/internal/org/repository/view/model/org_domain.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/org/model" es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) diff --git a/internal/org/repository/view/model/org_member.go b/internal/org/repository/view/model/org_member.go index 12510cdbc2..b26fc06002 100644 --- a/internal/org/repository/view/model/org_member.go +++ b/internal/org/repository/view/model/org_member.go @@ -8,7 +8,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/org/model" "github.com/lib/pq" ) diff --git a/internal/org/repository/view/query.go b/internal/org/repository/view/query.go index d8ff2aa6da..cc82c41e3e 100644 --- a/internal/org/repository/view/query.go +++ b/internal/org/repository/view/query.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" ) diff --git a/internal/project/model/api_config.go b/internal/project/model/api_config.go index 4a3a31202b..8668379922 100644 --- a/internal/project/model/api_config.go +++ b/internal/project/model/api_config.go @@ -8,7 +8,7 @@ import ( "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/id" ) diff --git a/internal/project/model/application.go b/internal/project/model/application.go index eba494caab..b828f7b0e7 100644 --- a/internal/project/model/application.go +++ b/internal/project/model/application.go @@ -3,7 +3,7 @@ package model import ( "github.com/golang/protobuf/ptypes/timestamp" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Application struct { diff --git a/internal/project/model/application_test.go b/internal/project/model/application_test.go index f9b6b8f237..527e964731 100644 --- a/internal/project/model/application_test.go +++ b/internal/project/model/application_test.go @@ -1,7 +1,7 @@ package model import ( - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/project/model/oidc_config.go b/internal/project/model/oidc_config.go index 647c8ac0a8..badacfabb1 100644 --- a/internal/project/model/oidc_config.go +++ b/internal/project/model/oidc_config.go @@ -9,7 +9,7 @@ import ( "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/id" key_model "github.com/caos/zitadel/internal/key/model" ) diff --git a/internal/project/model/project.go b/internal/project/model/project.go index 439f75e9cd..d19e04c3f9 100644 --- a/internal/project/model/project.go +++ b/internal/project/model/project.go @@ -3,7 +3,7 @@ package model import ( "github.com/golang/protobuf/ptypes/timestamp" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Project struct { diff --git a/internal/project/model/project_grant.go b/internal/project/model/project_grant.go index 9a0b5b8ce0..2c300a6b1c 100644 --- a/internal/project/model/project_grant.go +++ b/internal/project/model/project_grant.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type ProjectGrant struct { diff --git a/internal/project/model/project_grant_member.go b/internal/project/model/project_grant_member.go index cc784f52c0..002049231a 100644 --- a/internal/project/model/project_grant_member.go +++ b/internal/project/model/project_grant_member.go @@ -1,6 +1,6 @@ package model -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type ProjectGrantMember struct { es_models.ObjectRoot diff --git a/internal/project/model/project_member.go b/internal/project/model/project_member.go index 1aa301fd25..70ef09c72c 100644 --- a/internal/project/model/project_member.go +++ b/internal/project/model/project_member.go @@ -1,6 +1,6 @@ package model -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type ProjectMember struct { es_models.ObjectRoot diff --git a/internal/project/model/project_role.go b/internal/project/model/project_role.go index c63b369ffd..6f84c4763e 100644 --- a/internal/project/model/project_role.go +++ b/internal/project/model/project_role.go @@ -1,6 +1,6 @@ package model -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type ProjectRole struct { es_models.ObjectRoot diff --git a/internal/project/repository/eventsourcing/cache.go b/internal/project/repository/eventsourcing/cache.go index 6bf29563b2..28d1b521bc 100644 --- a/internal/project/repository/eventsourcing/cache.go +++ b/internal/project/repository/eventsourcing/cache.go @@ -4,7 +4,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/cache" "github.com/caos/zitadel/internal/cache/config" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" ) diff --git a/internal/project/repository/eventsourcing/model/api_config.go b/internal/project/repository/eventsourcing/model/api_config.go index 493b817c14..a8be0c11d3 100644 --- a/internal/project/repository/eventsourcing/model/api_config.go +++ b/internal/project/repository/eventsourcing/model/api_config.go @@ -6,7 +6,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/application.go b/internal/project/repository/eventsourcing/model/application.go index a08228c5da..2b72268940 100644 --- a/internal/project/repository/eventsourcing/model/application.go +++ b/internal/project/repository/eventsourcing/model/application.go @@ -5,7 +5,7 @@ import ( "github.com/caos/logging" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/application_test.go b/internal/project/repository/eventsourcing/model/application_test.go index 2be60d9c90..b2a1c731db 100644 --- a/internal/project/repository/eventsourcing/model/application_test.go +++ b/internal/project/repository/eventsourcing/model/application_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/oidc_config.go b/internal/project/repository/eventsourcing/model/oidc_config.go index 635d78d2fd..a6d7e9b15d 100644 --- a/internal/project/repository/eventsourcing/model/oidc_config.go +++ b/internal/project/repository/eventsourcing/model/oidc_config.go @@ -9,7 +9,7 @@ import ( "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" key_model "github.com/caos/zitadel/internal/key/model" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/oidc_config_test.go b/internal/project/repository/eventsourcing/model/oidc_config_test.go index 311e15f7de..b07eaea44d 100644 --- a/internal/project/repository/eventsourcing/model/oidc_config_test.go +++ b/internal/project/repository/eventsourcing/model/oidc_config_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestOIDCConfigChanges(t *testing.T) { diff --git a/internal/project/repository/eventsourcing/model/project.go b/internal/project/repository/eventsourcing/model/project.go index bdf133c300..51eef0db1d 100644 --- a/internal/project/repository/eventsourcing/model/project.go +++ b/internal/project/repository/eventsourcing/model/project.go @@ -5,7 +5,7 @@ import ( "github.com/caos/logging" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/project_grant.go b/internal/project/repository/eventsourcing/model/project_grant.go index 9cc750593f..ce95190e31 100644 --- a/internal/project/repository/eventsourcing/model/project_grant.go +++ b/internal/project/repository/eventsourcing/model/project_grant.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/caos/logging" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" "reflect" ) diff --git a/internal/project/repository/eventsourcing/model/project_grant_member.go b/internal/project/repository/eventsourcing/model/project_grant_member.go index 92d9a8a528..df0c3829a3 100644 --- a/internal/project/repository/eventsourcing/model/project_grant_member.go +++ b/internal/project/repository/eventsourcing/model/project_grant_member.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/caos/logging" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/project_grant_member_test.go b/internal/project/repository/eventsourcing/model/project_grant_member_test.go index 7bdf0d1ef4..6794f1b514 100644 --- a/internal/project/repository/eventsourcing/model/project_grant_member_test.go +++ b/internal/project/repository/eventsourcing/model/project_grant_member_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/project/repository/eventsourcing/model/project_grant_test.go b/internal/project/repository/eventsourcing/model/project_grant_test.go index 8b64b927f9..44b76c49b8 100644 --- a/internal/project/repository/eventsourcing/model/project_grant_test.go +++ b/internal/project/repository/eventsourcing/model/project_grant_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" "testing" ) diff --git a/internal/project/repository/eventsourcing/model/project_member.go b/internal/project/repository/eventsourcing/model/project_member.go index 3f8c57dd8e..1473653d5a 100644 --- a/internal/project/repository/eventsourcing/model/project_member.go +++ b/internal/project/repository/eventsourcing/model/project_member.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/caos/logging" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/project_member_test.go b/internal/project/repository/eventsourcing/model/project_member_test.go index 5325d63f12..ce18b86e6c 100644 --- a/internal/project/repository/eventsourcing/model/project_member_test.go +++ b/internal/project/repository/eventsourcing/model/project_member_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/project/repository/eventsourcing/model/project_role.go b/internal/project/repository/eventsourcing/model/project_role.go index 0f6967fba0..15295ace36 100644 --- a/internal/project/repository/eventsourcing/model/project_role.go +++ b/internal/project/repository/eventsourcing/model/project_role.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/caos/logging" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/project_test.go b/internal/project/repository/eventsourcing/model/project_test.go index 51bba17c99..5da6f8e9f9 100644 --- a/internal/project/repository/eventsourcing/model/project_test.go +++ b/internal/project/repository/eventsourcing/model/project_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" ) diff --git a/internal/project/repository/eventsourcing/model/types.go b/internal/project/repository/eventsourcing/model/types.go index 581627142d..1828c5b84a 100644 --- a/internal/project/repository/eventsourcing/model/types.go +++ b/internal/project/repository/eventsourcing/model/types.go @@ -1,6 +1,6 @@ package model -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" const ( ProjectAggregate models.AggregateType = "project" diff --git a/internal/project/repository/eventsourcing/project.go b/internal/project/repository/eventsourcing/project.go index 5a74cf6a61..2493865809 100644 --- a/internal/project/repository/eventsourcing/project.go +++ b/internal/project/repository/eventsourcing/project.go @@ -5,8 +5,8 @@ import ( "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" - es_sdk "github.com/caos/zitadel/internal/eventstore/sdk" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" + es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk" "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" ) diff --git a/internal/project/repository/view/model/application.go b/internal/project/repository/view/model/application.go index fe682d8f02..f46d36cd08 100644 --- a/internal/project/repository/view/model/application.go +++ b/internal/project/repository/view/model/application.go @@ -9,7 +9,7 @@ import ( http_util "github.com/caos/zitadel/internal/api/http" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" ) diff --git a/internal/project/repository/view/model/application_test.go b/internal/project/repository/view/model/application_test.go index ae131ab5f4..39fad75b38 100644 --- a/internal/project/repository/view/model/application_test.go +++ b/internal/project/repository/view/model/application_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "testing" diff --git a/internal/project/repository/view/model/project.go b/internal/project/repository/view/model/project.go index 1671adaaec..0ec8c84665 100644 --- a/internal/project/repository/view/model/project.go +++ b/internal/project/repository/view/model/project.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" ) diff --git a/internal/project/repository/view/model/project_grant.go b/internal/project/repository/view/model/project_grant.go index 80d386e236..31a0261516 100644 --- a/internal/project/repository/view/model/project_grant.go +++ b/internal/project/repository/view/model/project_grant.go @@ -4,7 +4,7 @@ import ( "encoding/json" "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "github.com/lib/pq" diff --git a/internal/project/repository/view/model/project_grant_member.go b/internal/project/repository/view/model/project_grant_member.go index b645dd867f..2614b0dfbb 100644 --- a/internal/project/repository/view/model/project_grant_member.go +++ b/internal/project/repository/view/model/project_grant_member.go @@ -6,7 +6,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "github.com/lib/pq" diff --git a/internal/project/repository/view/model/project_grant_member_test.go b/internal/project/repository/view/model/project_grant_member_test.go index 2710e2f149..d41b49f35f 100644 --- a/internal/project/repository/view/model/project_grant_member_test.go +++ b/internal/project/repository/view/model/project_grant_member_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "github.com/lib/pq" "reflect" diff --git a/internal/project/repository/view/model/project_grant_test.go b/internal/project/repository/view/model/project_grant_test.go index 98e0f1c6ca..4cc811ee90 100644 --- a/internal/project/repository/view/model/project_grant_test.go +++ b/internal/project/repository/view/model/project_grant_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "github.com/lib/pq" diff --git a/internal/project/repository/view/model/project_member.go b/internal/project/repository/view/model/project_member.go index 47fc7b8430..bd90fe0f3e 100644 --- a/internal/project/repository/view/model/project_member.go +++ b/internal/project/repository/view/model/project_member.go @@ -6,7 +6,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "github.com/lib/pq" diff --git a/internal/project/repository/view/model/project_member_test.go b/internal/project/repository/view/model/project_member_test.go index e5058ec4ff..9265a1e04d 100644 --- a/internal/project/repository/view/model/project_member_test.go +++ b/internal/project/repository/view/model/project_member_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "github.com/lib/pq" "reflect" diff --git a/internal/project/repository/view/model/project_role.go b/internal/project/repository/view/model/project_role.go index b7adcb3d0f..a1c3da4798 100644 --- a/internal/project/repository/view/model/project_role.go +++ b/internal/project/repository/view/model/project_role.go @@ -6,7 +6,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" ) diff --git a/internal/project/repository/view/model/project_role_test.go b/internal/project/repository/view/model/project_role_test.go index bd1809095b..46e3cafb02 100644 --- a/internal/project/repository/view/model/project_role_test.go +++ b/internal/project/repository/view/model/project_role_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "testing" ) diff --git a/internal/project/repository/view/model/project_test.go b/internal/project/repository/view/model/project_test.go index 72c0f79405..1a004b4c50 100644 --- a/internal/project/repository/view/model/project_test.go +++ b/internal/project/repository/view/model/project_test.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/model" es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" "testing" diff --git a/internal/project/repository/view/query.go b/internal/project/repository/view/query.go index 3659b27116..b4fabf2629 100644 --- a/internal/project/repository/view/query.go +++ b/internal/project/repository/view/query.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" ) diff --git a/internal/v2/query/converter.go b/internal/query/converter.go similarity index 97% rename from internal/v2/query/converter.go rename to internal/query/converter.go index 48a56a7de1..2e3f9ab14f 100644 --- a/internal/v2/query/converter.go +++ b/internal/query/converter.go @@ -1,10 +1,10 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" ) func readModelToIAM(readModel *ReadModel) *model.IAM { diff --git a/internal/v2/query/iam_idp_config.go b/internal/query/iam_idp_config.go similarity index 88% rename from internal/v2/query/iam_idp_config.go rename to internal/query/iam_idp_config.go index 24a562fc63..2112ab30d1 100644 --- a/internal/v2/query/iam_idp_config.go +++ b/internal/query/iam_idp_config.go @@ -2,7 +2,7 @@ package query import ( "context" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" ) func (r *QuerySide) DefaultIDPConfigByID(ctx context.Context, idpConfigID string) (*domain.IDPConfigView, error) { diff --git a/internal/v2/query/iam_idp_config_model.go b/internal/query/iam_idp_config_model.go similarity index 93% rename from internal/v2/query/iam_idp_config_model.go rename to internal/query/iam_idp_config_model.go index fc8460c8b2..c9a80c01ec 100644 --- a/internal/v2/query/iam_idp_config_model.go +++ b/internal/query/iam_idp_config_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) type IAMIDPConfigReadModel struct { diff --git a/internal/v2/query/iam_idp_configs_model.go b/internal/query/iam_idp_configs_model.go similarity index 90% rename from internal/v2/query/iam_idp_configs_model.go rename to internal/query/iam_idp_configs_model.go index c6f99972ff..0d6333e412 100644 --- a/internal/v2/query/iam_idp_configs_model.go +++ b/internal/query/iam_idp_configs_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) type IAMIDPConfigsReadModel struct { diff --git a/internal/v2/query/iam_member_model.go b/internal/query/iam_member_model.go similarity index 85% rename from internal/v2/query/iam_member_model.go rename to internal/query/iam_member_model.go index 898225733c..febb461be3 100644 --- a/internal/v2/query/iam_member_model.go +++ b/internal/query/iam_member_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/member" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/member" ) type IAMMemberReadModel struct { diff --git a/internal/v2/query/iam_members_model.go b/internal/query/iam_members_model.go similarity index 82% rename from internal/v2/query/iam_members_model.go rename to internal/query/iam_members_model.go index fd2325aa36..c28c0fa557 100644 --- a/internal/v2/query/iam_members_model.go +++ b/internal/query/iam_members_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" ) type IAMMembersReadModel struct { diff --git a/internal/v2/query/iam_model.go b/internal/query/iam_model.go similarity index 92% rename from internal/v2/query/iam_model.go rename to internal/query/iam_model.go index 4548c6b0fe..ab5af737fc 100644 --- a/internal/v2/query/iam_model.go +++ b/internal/query/iam_model.go @@ -1,11 +1,11 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/member" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/member" + "github.com/caos/zitadel/internal/repository/policy" ) type ReadModel struct { diff --git a/internal/v2/query/iam_policy_label_model.go b/internal/query/iam_policy_label_model.go similarity index 77% rename from internal/v2/query/iam_policy_label_model.go rename to internal/query/iam_policy_label_model.go index fb91f3d9cc..ece7d5b1ee 100644 --- a/internal/v2/query/iam_policy_label_model.go +++ b/internal/query/iam_policy_label_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMLabelPolicyReadModel struct{ LabelPolicyReadModel } diff --git a/internal/v2/query/iam_policy_login_model.go b/internal/query/iam_policy_login_model.go similarity index 77% rename from internal/v2/query/iam_policy_login_model.go rename to internal/query/iam_policy_login_model.go index eabb539747..87305ae111 100644 --- a/internal/v2/query/iam_policy_login_model.go +++ b/internal/query/iam_policy_login_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMLoginPolicyReadModel struct{ LoginPolicyReadModel } diff --git a/internal/v2/query/iam_policy_org_iam_model.go b/internal/query/iam_policy_org_iam_model.go similarity index 72% rename from internal/v2/query/iam_policy_org_iam_model.go rename to internal/query/iam_policy_org_iam_model.go index b8592baf31..31083564c3 100644 --- a/internal/v2/query/iam_policy_org_iam_model.go +++ b/internal/query/iam_policy_org_iam_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMOrgIAMPolicyReadModel struct{ OrgIAMPolicyReadModel } diff --git a/internal/v2/query/iam_policy_password_age_model.go b/internal/query/iam_policy_password_age_model.go similarity index 79% rename from internal/v2/query/iam_policy_password_age_model.go rename to internal/query/iam_policy_password_age_model.go index d557a1eb77..018604d70c 100644 --- a/internal/v2/query/iam_policy_password_age_model.go +++ b/internal/query/iam_policy_password_age_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMPasswordAgePolicyReadModel struct { diff --git a/internal/v2/query/iam_policy_password_complexity_model.go b/internal/query/iam_policy_password_complexity_model.go similarity index 81% rename from internal/v2/query/iam_policy_password_complexity_model.go rename to internal/query/iam_policy_password_complexity_model.go index 48d9a3326c..c559c15af4 100644 --- a/internal/v2/query/iam_policy_password_complexity_model.go +++ b/internal/query/iam_policy_password_complexity_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMPasswordComplexityPolicyReadModel struct { diff --git a/internal/v2/query/iam_policy_password_lockout_model.go b/internal/query/iam_policy_password_lockout_model.go similarity index 80% rename from internal/v2/query/iam_policy_password_lockout_model.go rename to internal/query/iam_policy_password_lockout_model.go index b3f4349b56..46d4d52f08 100644 --- a/internal/v2/query/iam_policy_password_lockout_model.go +++ b/internal/query/iam_policy_password_lockout_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/iam" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/iam" + "github.com/caos/zitadel/internal/repository/policy" ) type IAMPasswordLockoutPolicyReadModel struct { diff --git a/internal/v2/query/idp_config_model.go b/internal/query/idp_config_model.go similarity index 94% rename from internal/v2/query/idp_config_model.go rename to internal/query/idp_config_model.go index a0e51e2331..35ffecdd96 100644 --- a/internal/v2/query/idp_config_model.go +++ b/internal/query/idp_config_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/idpconfig" ) type IDPConfigReadModel struct { diff --git a/internal/v2/query/idp_configs_model.go b/internal/query/idp_configs_model.go similarity index 93% rename from internal/v2/query/idp_configs_model.go rename to internal/query/idp_configs_model.go index 2b288a5614..28852c1765 100644 --- a/internal/v2/query/idp_configs_model.go +++ b/internal/query/idp_configs_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/idpconfig" ) type IDPConfigsReadModel struct { diff --git a/internal/v2/query/member.go b/internal/query/member.go similarity index 100% rename from internal/v2/query/member.go rename to internal/query/member.go diff --git a/internal/v2/query/member_model.go b/internal/query/member_model.go similarity index 86% rename from internal/v2/query/member_model.go rename to internal/query/member_model.go index c9a2fb3b2a..0cdf5d7f9e 100644 --- a/internal/v2/query/member_model.go +++ b/internal/query/member_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/member" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/member" ) //MemberReadModel represenets the default member view. diff --git a/internal/v2/query/members_model.go b/internal/query/members_model.go similarity index 91% rename from internal/v2/query/members_model.go rename to internal/query/members_model.go index e88368e522..78feee37c8 100644 --- a/internal/v2/query/members_model.go +++ b/internal/query/members_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/member" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/member" ) type MembersReadModel struct { diff --git a/internal/v2/query/oidc_config_model.go b/internal/query/oidc_config_model.go similarity index 90% rename from internal/v2/query/oidc_config_model.go rename to internal/query/oidc_config_model.go index 763119cd1e..b0ee26f9c9 100644 --- a/internal/v2/query/oidc_config_model.go +++ b/internal/query/oidc_config_model.go @@ -2,9 +2,9 @@ package query import ( "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/idpconfig" ) type OIDCConfigReadModel struct { diff --git a/internal/v2/query/org_member_model.go b/internal/query/org_member_model.go similarity index 89% rename from internal/v2/query/org_member_model.go rename to internal/query/org_member_model.go index ea28e81908..eaf0757d83 100644 --- a/internal/v2/query/org_member_model.go +++ b/internal/query/org_member_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" ) type OrgMembersReadModel struct { diff --git a/internal/v2/query/org_policy_label_model.go b/internal/query/org_policy_label_model.go similarity index 77% rename from internal/v2/query/org_policy_label_model.go rename to internal/query/org_policy_label_model.go index ae7d466e18..8cff25c014 100644 --- a/internal/v2/query/org_policy_label_model.go +++ b/internal/query/org_policy_label_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgLabelPolicyReadModel struct{ LabelPolicyReadModel } diff --git a/internal/v2/query/org_policy_login_model.go b/internal/query/org_policy_login_model.go similarity index 77% rename from internal/v2/query/org_policy_login_model.go rename to internal/query/org_policy_login_model.go index 6f27dc995b..24ca70be9a 100644 --- a/internal/v2/query/org_policy_login_model.go +++ b/internal/query/org_policy_login_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgLoginPolicyReadModel struct{ LoginPolicyReadModel } diff --git a/internal/v2/query/org_policy_org_iam_model.go b/internal/query/org_policy_org_iam_model.go similarity index 72% rename from internal/v2/query/org_policy_org_iam_model.go rename to internal/query/org_policy_org_iam_model.go index a8bb3bffac..b2b3da7568 100644 --- a/internal/v2/query/org_policy_org_iam_model.go +++ b/internal/query/org_policy_org_iam_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgOrgIAMPolicyReadModel struct{ OrgIAMPolicyReadModel } diff --git a/internal/v2/query/org_policy_password_age_model.go b/internal/query/org_policy_password_age_model.go similarity index 79% rename from internal/v2/query/org_policy_password_age_model.go rename to internal/query/org_policy_password_age_model.go index 1715cbbaa4..e27fdb95b9 100644 --- a/internal/v2/query/org_policy_password_age_model.go +++ b/internal/query/org_policy_password_age_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgPasswordAgePolicyReadModel struct { diff --git a/internal/v2/query/org_policy_password_complexity_model.go b/internal/query/org_policy_password_complexity_model.go similarity index 81% rename from internal/v2/query/org_policy_password_complexity_model.go rename to internal/query/org_policy_password_complexity_model.go index 60898931c7..4c29d94f80 100644 --- a/internal/v2/query/org_policy_password_complexity_model.go +++ b/internal/query/org_policy_password_complexity_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgPasswordComplexityPolicyReadModel struct { diff --git a/internal/v2/query/org_policy_password_lockout_model.go b/internal/query/org_policy_password_lockout_model.go similarity index 80% rename from internal/v2/query/org_policy_password_lockout_model.go rename to internal/query/org_policy_password_lockout_model.go index 8e77aaa6d3..e91f30dbfe 100644 --- a/internal/v2/query/org_policy_password_lockout_model.go +++ b/internal/query/org_policy_password_lockout_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/org" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/org" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgPasswordLockoutPolicyReadModel struct { diff --git a/internal/v2/query/policy_label_model.go b/internal/query/policy_label_model.go similarity index 86% rename from internal/v2/query/policy_label_model.go rename to internal/query/policy_label_model.go index 9ff9fcae0a..4a845c5c00 100644 --- a/internal/v2/query/policy_label_model.go +++ b/internal/query/policy_label_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type LabelPolicyReadModel struct { diff --git a/internal/v2/query/policy_login_model.go b/internal/query/policy_login_model.go similarity index 88% rename from internal/v2/query/policy_login_model.go rename to internal/query/policy_login_model.go index a5d321e2ce..b940280cd8 100644 --- a/internal/v2/query/policy_login_model.go +++ b/internal/query/policy_login_model.go @@ -1,9 +1,9 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type LoginPolicyReadModel struct { diff --git a/internal/v2/query/policy_org_iam_model.go b/internal/query/policy_org_iam_model.go similarity index 82% rename from internal/v2/query/policy_org_iam_model.go rename to internal/query/policy_org_iam_model.go index 10f3432a89..04774c92b2 100644 --- a/internal/v2/query/policy_org_iam_model.go +++ b/internal/query/policy_org_iam_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type OrgIAMPolicyReadModel struct { diff --git a/internal/v2/query/policy_password_age_model.go b/internal/query/policy_password_age_model.go similarity index 84% rename from internal/v2/query/policy_password_age_model.go rename to internal/query/policy_password_age_model.go index 57a928784f..52afd6546b 100644 --- a/internal/v2/query/policy_password_age_model.go +++ b/internal/query/policy_password_age_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type PasswordAgePolicyReadModel struct { diff --git a/internal/v2/query/policy_password_complexity_model.go b/internal/query/policy_password_complexity_model.go similarity index 90% rename from internal/v2/query/policy_password_complexity_model.go rename to internal/query/policy_password_complexity_model.go index b1588b235c..db17f74412 100644 --- a/internal/v2/query/policy_password_complexity_model.go +++ b/internal/query/policy_password_complexity_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type PasswordComplexityPolicyReadModel struct { diff --git a/internal/v2/query/policy_password_lockout_model.go b/internal/query/policy_password_lockout_model.go similarity index 86% rename from internal/v2/query/policy_password_lockout_model.go rename to internal/query/policy_password_lockout_model.go index e7eb175251..60f20fc248 100644 --- a/internal/v2/query/policy_password_lockout_model.go +++ b/internal/query/policy_password_lockout_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/policy" ) type PasswordLockoutPolicyReadModel struct { diff --git a/internal/v2/query/query.go b/internal/query/query.go similarity index 89% rename from internal/v2/query/query.go rename to internal/query/query.go index 599b0da5ca..085e8b8c1d 100644 --- a/internal/v2/query/query.go +++ b/internal/query/query.go @@ -2,15 +2,15 @@ package query import ( "context" - usr_repo "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/eventstore" + usr_repo "github.com/caos/zitadel/internal/repository/user" sd "github.com/caos/zitadel/internal/config/systemdefaults" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/id" + iam_repo "github.com/caos/zitadel/internal/repository/iam" "github.com/caos/zitadel/internal/telemetry/tracing" - iam_repo "github.com/caos/zitadel/internal/v2/repository/iam" ) type QuerySide struct { diff --git a/internal/v2/query/user.go b/internal/query/user.go similarity index 84% rename from internal/v2/query/user.go rename to internal/query/user.go index 815a04f0de..dc3c31ebc1 100644 --- a/internal/v2/query/user.go +++ b/internal/query/user.go @@ -2,7 +2,7 @@ package query import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) func (q *QuerySide) UserEvents(ctx context.Context, orgID, userID string, sequence uint64) ([]eventstore.EventReader, error) { diff --git a/internal/v2/query/user_model.go b/internal/query/user_model.go similarity index 92% rename from internal/v2/query/user_model.go rename to internal/query/user_model.go index f7f4e9af31..fd66096d9e 100644 --- a/internal/v2/query/user_model.go +++ b/internal/query/user_model.go @@ -1,8 +1,8 @@ package query import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/repository/user" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/repository/user" ) type UserReadModel struct { diff --git a/internal/v2/repository/iam/aggregate.go b/internal/repository/iam/aggregate.go similarity index 79% rename from internal/v2/repository/iam/aggregate.go rename to internal/repository/iam/aggregate.go index 9ab7fdcb46..e979aa55c7 100644 --- a/internal/v2/repository/iam/aggregate.go +++ b/internal/repository/iam/aggregate.go @@ -1,7 +1,7 @@ package iam import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) const ( diff --git a/internal/v2/repository/iam/event_iam_project_set.go b/internal/repository/iam/event_iam_project_set.go similarity index 90% rename from internal/v2/repository/iam/event_iam_project_set.go rename to internal/repository/iam/event_iam_project_set.go index b8ece01465..b975c83b3f 100644 --- a/internal/v2/repository/iam/event_iam_project_set.go +++ b/internal/repository/iam/event_iam_project_set.go @@ -3,10 +3,10 @@ package iam import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/iam/event_org_set.go b/internal/repository/iam/event_org_set.go similarity index 90% rename from internal/v2/repository/iam/event_org_set.go rename to internal/repository/iam/event_org_set.go index 356dd9fa97..54887bd505 100644 --- a/internal/v2/repository/iam/event_org_set.go +++ b/internal/repository/iam/event_org_set.go @@ -3,10 +3,10 @@ package iam import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/iam/events_step.go b/internal/repository/iam/events_step.go similarity index 90% rename from internal/v2/repository/iam/events_step.go rename to internal/repository/iam/events_step.go index e6a1bfe812..07255a22a8 100644 --- a/internal/v2/repository/iam/events_step.go +++ b/internal/repository/iam/events_step.go @@ -3,11 +3,11 @@ package iam import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/iam/eventstore.go b/internal/repository/iam/eventstore.go similarity index 98% rename from internal/v2/repository/iam/eventstore.go rename to internal/repository/iam/eventstore.go index 4a239fdad4..e55e77360e 100644 --- a/internal/v2/repository/iam/eventstore.go +++ b/internal/repository/iam/eventstore.go @@ -1,7 +1,7 @@ package iam import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) func RegisterEventMappers(es *eventstore.Eventstore) { diff --git a/internal/v2/repository/iam/idp_config.go b/internal/repository/iam/idp_config.go similarity index 95% rename from internal/v2/repository/iam/idp_config.go rename to internal/repository/iam/idp_config.go index 8a285baef0..1f2226ece7 100644 --- a/internal/v2/repository/iam/idp_config.go +++ b/internal/repository/iam/idp_config.go @@ -2,11 +2,11 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/idpconfig" ) const ( diff --git a/internal/v2/repository/iam/idp_oidc_config.go b/internal/repository/iam/idp_oidc_config.go similarity index 90% rename from internal/v2/repository/iam/idp_oidc_config.go rename to internal/repository/iam/idp_oidc_config.go index 23506bc3c0..5bf1a04308 100644 --- a/internal/v2/repository/iam/idp_oidc_config.go +++ b/internal/repository/iam/idp_oidc_config.go @@ -2,12 +2,12 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/idpconfig" ) const ( diff --git a/internal/v2/repository/iam/member.go b/internal/repository/iam/member.go similarity index 92% rename from internal/v2/repository/iam/member.go rename to internal/repository/iam/member.go index e0ea6e1960..2a2487af96 100644 --- a/internal/v2/repository/iam/member.go +++ b/internal/repository/iam/member.go @@ -2,10 +2,10 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/member" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/member" ) var ( diff --git a/internal/v2/repository/iam/migrate_unique_constraints.go b/internal/repository/iam/migrate_unique_constraints.go similarity index 91% rename from internal/v2/repository/iam/migrate_unique_constraints.go rename to internal/repository/iam/migrate_unique_constraints.go index 9728e9d88a..08868a95d8 100644 --- a/internal/v2/repository/iam/migrate_unique_constraints.go +++ b/internal/repository/iam/migrate_unique_constraints.go @@ -2,10 +2,10 @@ package iam import ( "context" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/iam/policy_label.go b/internal/repository/iam/policy_label.go similarity index 91% rename from internal/v2/repository/iam/policy_label.go rename to internal/repository/iam/policy_label.go index be5ecf6511..318988293e 100644 --- a/internal/v2/repository/iam/policy_label.go +++ b/internal/repository/iam/policy_label.go @@ -2,10 +2,10 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/iam/policy_login.go b/internal/repository/iam/policy_login.go similarity index 89% rename from internal/v2/repository/iam/policy_login.go rename to internal/repository/iam/policy_login.go index 5cf242b269..163098c49e 100644 --- a/internal/v2/repository/iam/policy_login.go +++ b/internal/repository/iam/policy_login.go @@ -2,11 +2,11 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/iam/policy_login_factors.go b/internal/repository/iam/policy_login_factors.go similarity index 94% rename from internal/v2/repository/iam/policy_login_factors.go rename to internal/repository/iam/policy_login_factors.go index b584f0444d..5d5ef7562c 100644 --- a/internal/v2/repository/iam/policy_login_factors.go +++ b/internal/repository/iam/policy_login_factors.go @@ -2,11 +2,11 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/iam/policy_login_identity_provider.go b/internal/repository/iam/policy_login_identity_provider.go similarity index 93% rename from internal/v2/repository/iam/policy_login_identity_provider.go rename to internal/repository/iam/policy_login_identity_provider.go index 991a37f380..a09b598fe5 100644 --- a/internal/v2/repository/iam/policy_login_identity_provider.go +++ b/internal/repository/iam/policy_login_identity_provider.go @@ -2,11 +2,11 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/iam/policy_mail_template.go b/internal/repository/iam/policy_mail_template.go similarity index 91% rename from internal/v2/repository/iam/policy_mail_template.go rename to internal/repository/iam/policy_mail_template.go index 22c3b8dfd4..4adee3e93d 100644 --- a/internal/v2/repository/iam/policy_mail_template.go +++ b/internal/repository/iam/policy_mail_template.go @@ -2,9 +2,9 @@ package iam import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/iam/policy_mail_text.go b/internal/repository/iam/policy_mail_text.go similarity index 91% rename from internal/v2/repository/iam/policy_mail_text.go rename to internal/repository/iam/policy_mail_text.go index 5a8167c74f..6dfa27b9ce 100644 --- a/internal/v2/repository/iam/policy_mail_text.go +++ b/internal/repository/iam/policy_mail_text.go @@ -2,9 +2,9 @@ package iam import ( "context" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/iam/policy_org_iam.go b/internal/repository/iam/policy_org_iam.go similarity index 91% rename from internal/v2/repository/iam/policy_org_iam.go rename to internal/repository/iam/policy_org_iam.go index b7acf00cec..ea3dfea732 100644 --- a/internal/v2/repository/iam/policy_org_iam.go +++ b/internal/repository/iam/policy_org_iam.go @@ -2,10 +2,10 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/iam/policy_password_age.go b/internal/repository/iam/policy_password_age.go similarity index 92% rename from internal/v2/repository/iam/policy_password_age.go rename to internal/repository/iam/policy_password_age.go index 99a457b547..f4a28145e2 100644 --- a/internal/v2/repository/iam/policy_password_age.go +++ b/internal/repository/iam/policy_password_age.go @@ -2,10 +2,10 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/iam/policy_password_complexity.go b/internal/repository/iam/policy_password_complexity.go similarity index 93% rename from internal/v2/repository/iam/policy_password_complexity.go rename to internal/repository/iam/policy_password_complexity.go index e9ae4610a4..cb3fdbe8c4 100644 --- a/internal/v2/repository/iam/policy_password_complexity.go +++ b/internal/repository/iam/policy_password_complexity.go @@ -2,10 +2,10 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) const ( diff --git a/internal/v2/repository/iam/policy_password_lockout.go b/internal/repository/iam/policy_password_lockout.go similarity index 92% rename from internal/v2/repository/iam/policy_password_lockout.go rename to internal/repository/iam/policy_password_lockout.go index 41ae417cc4..3abe256188 100644 --- a/internal/v2/repository/iam/policy_password_lockout.go +++ b/internal/repository/iam/policy_password_lockout.go @@ -2,10 +2,10 @@ package iam import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/idpconfig/idp_config.go b/internal/repository/idpconfig/idp_config.go similarity index 97% rename from internal/v2/repository/idpconfig/idp_config.go rename to internal/repository/idpconfig/idp_config.go index 2efa981c0b..e022503e68 100644 --- a/internal/v2/repository/idpconfig/idp_config.go +++ b/internal/repository/idpconfig/idp_config.go @@ -2,11 +2,11 @@ package idpconfig import ( "encoding/json" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/idpconfig/oidc_config.go b/internal/repository/idpconfig/oidc_config.go similarity index 96% rename from internal/v2/repository/idpconfig/oidc_config.go rename to internal/repository/idpconfig/oidc_config.go index e7c21c6d7c..ef7edf2150 100644 --- a/internal/v2/repository/idpconfig/oidc_config.go +++ b/internal/repository/idpconfig/oidc_config.go @@ -2,12 +2,12 @@ package idpconfig import ( "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( @@ -16,7 +16,7 @@ const ( ) type OIDCConfigAddedEvent struct { - eventstore.BaseEvent + eventstore.BaseEvent `json:"-"` IDPConfigID string `json:"idpConfigId"` ClientID string `json:"clientId,omitempty"` diff --git a/internal/v2/repository/keypair/aggregate.go b/internal/repository/keypair/aggregate.go similarity index 74% rename from internal/v2/repository/keypair/aggregate.go rename to internal/repository/keypair/aggregate.go index 44cdd8f152..a5ed4c4e37 100644 --- a/internal/v2/repository/keypair/aggregate.go +++ b/internal/repository/keypair/aggregate.go @@ -1,7 +1,7 @@ package usergrant import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) const ( diff --git a/internal/v2/repository/keypair/eventstore.go b/internal/repository/keypair/eventstore.go similarity index 75% rename from internal/v2/repository/keypair/eventstore.go rename to internal/repository/keypair/eventstore.go index 49d9674bda..ea7e269da8 100644 --- a/internal/v2/repository/keypair/eventstore.go +++ b/internal/repository/keypair/eventstore.go @@ -1,7 +1,7 @@ package usergrant import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) func RegisterEventMappers(es *eventstore.Eventstore) { diff --git a/internal/v2/repository/keypair/key_pair.go b/internal/repository/keypair/key_pair.go similarity index 91% rename from internal/v2/repository/keypair/key_pair.go rename to internal/repository/keypair/key_pair.go index 4b18fd39f3..9ca2e837e3 100644 --- a/internal/v2/repository/keypair/key_pair.go +++ b/internal/repository/keypair/key_pair.go @@ -4,10 +4,10 @@ import ( "context" "encoding/json" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" "time" ) diff --git a/internal/v2/repository/member/events.go b/internal/repository/member/events.go similarity index 96% rename from internal/v2/repository/member/events.go rename to internal/repository/member/events.go index 9a49c63e13..ba591c9e13 100644 --- a/internal/v2/repository/member/events.go +++ b/internal/repository/member/events.go @@ -4,8 +4,8 @@ import ( "encoding/json" "fmt" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/org/aggregate.go b/internal/repository/org/aggregate.go similarity index 79% rename from internal/v2/repository/org/aggregate.go rename to internal/repository/org/aggregate.go index d09fe5e6f8..a2b216c8e1 100644 --- a/internal/v2/repository/org/aggregate.go +++ b/internal/repository/org/aggregate.go @@ -1,7 +1,7 @@ package org import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) const ( diff --git a/internal/v2/repository/org/domain.go b/internal/repository/org/domain.go similarity index 97% rename from internal/v2/repository/org/domain.go rename to internal/repository/org/domain.go index 237a968204..aea166ae7b 100644 --- a/internal/v2/repository/org/domain.go +++ b/internal/repository/org/domain.go @@ -3,12 +3,12 @@ package org import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/org/eventstore.go b/internal/repository/org/eventstore.go similarity index 98% rename from internal/v2/repository/org/eventstore.go rename to internal/repository/org/eventstore.go index d02707957d..86a345f5bf 100644 --- a/internal/v2/repository/org/eventstore.go +++ b/internal/repository/org/eventstore.go @@ -1,7 +1,7 @@ package org import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) func RegisterEventMappers(es *eventstore.Eventstore) { diff --git a/internal/v2/repository/org/idp_config.go b/internal/repository/org/idp_config.go similarity index 95% rename from internal/v2/repository/org/idp_config.go rename to internal/repository/org/idp_config.go index a64e5b2ffe..0e787872f7 100644 --- a/internal/v2/repository/org/idp_config.go +++ b/internal/repository/org/idp_config.go @@ -2,11 +2,11 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/idpconfig" ) const ( diff --git a/internal/v2/repository/org/idp_oidc_config.go b/internal/repository/org/idp_oidc_config.go similarity index 90% rename from internal/v2/repository/org/idp_oidc_config.go rename to internal/repository/org/idp_oidc_config.go index 518e901977..8c9e07f323 100644 --- a/internal/v2/repository/org/idp_oidc_config.go +++ b/internal/repository/org/idp_oidc_config.go @@ -2,12 +2,12 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/idpconfig" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/idpconfig" ) const ( diff --git a/internal/v2/repository/org/member.go b/internal/repository/org/member.go similarity index 92% rename from internal/v2/repository/org/member.go rename to internal/repository/org/member.go index c79a17990d..7c6e21c856 100644 --- a/internal/v2/repository/org/member.go +++ b/internal/repository/org/member.go @@ -2,10 +2,10 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/member" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/member" ) var ( diff --git a/internal/v2/repository/org/org.go b/internal/repository/org/org.go similarity index 97% rename from internal/v2/repository/org/org.go rename to internal/repository/org/org.go index b705678853..ec96c5cedd 100644 --- a/internal/v2/repository/org/org.go +++ b/internal/repository/org/org.go @@ -3,10 +3,10 @@ package org import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/org/policy_label.go b/internal/repository/org/policy_label.go similarity index 93% rename from internal/v2/repository/org/policy_label.go rename to internal/repository/org/policy_label.go index 429f699a04..341940a928 100644 --- a/internal/v2/repository/org/policy_label.go +++ b/internal/repository/org/policy_label.go @@ -2,10 +2,10 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_login.go b/internal/repository/org/policy_login.go similarity index 92% rename from internal/v2/repository/org/policy_login.go rename to internal/repository/org/policy_login.go index a4ed58f36e..d2d64feaef 100644 --- a/internal/v2/repository/org/policy_login.go +++ b/internal/repository/org/policy_login.go @@ -2,11 +2,11 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_login_factors.go b/internal/repository/org/policy_login_factors.go similarity index 94% rename from internal/v2/repository/org/policy_login_factors.go rename to internal/repository/org/policy_login_factors.go index 1ff97613c8..49e12b7911 100644 --- a/internal/v2/repository/org/policy_login_factors.go +++ b/internal/repository/org/policy_login_factors.go @@ -2,11 +2,11 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_login_identity_provider.go b/internal/repository/org/policy_login_identity_provider.go similarity index 93% rename from internal/v2/repository/org/policy_login_identity_provider.go rename to internal/repository/org/policy_login_identity_provider.go index 624680ed5f..c8b4266de4 100644 --- a/internal/v2/repository/org/policy_login_identity_provider.go +++ b/internal/repository/org/policy_login_identity_provider.go @@ -2,11 +2,11 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/domain" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_mail_template.go b/internal/repository/org/policy_mail_template.go similarity index 93% rename from internal/v2/repository/org/policy_mail_template.go rename to internal/repository/org/policy_mail_template.go index bfcb3d3e69..513fed3f80 100644 --- a/internal/v2/repository/org/policy_mail_template.go +++ b/internal/repository/org/policy_mail_template.go @@ -2,10 +2,10 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_mail_text.go b/internal/repository/org/policy_mail_text.go similarity index 93% rename from internal/v2/repository/org/policy_mail_text.go rename to internal/repository/org/policy_mail_text.go index b6d11ca199..5a6ddba69c 100644 --- a/internal/v2/repository/org/policy_mail_text.go +++ b/internal/repository/org/policy_mail_text.go @@ -2,10 +2,10 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_org_iam.go b/internal/repository/org/policy_org_iam.go similarity index 94% rename from internal/v2/repository/org/policy_org_iam.go rename to internal/repository/org/policy_org_iam.go index 2c3b043af9..c4df42c830 100644 --- a/internal/v2/repository/org/policy_org_iam.go +++ b/internal/repository/org/policy_org_iam.go @@ -2,10 +2,10 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_password_age.go b/internal/repository/org/policy_password_age.go similarity index 94% rename from internal/v2/repository/org/policy_password_age.go rename to internal/repository/org/policy_password_age.go index 549d414d1d..a52e2b9207 100644 --- a/internal/v2/repository/org/policy_password_age.go +++ b/internal/repository/org/policy_password_age.go @@ -2,10 +2,10 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_password_complexity.go b/internal/repository/org/policy_password_complexity.go similarity index 95% rename from internal/v2/repository/org/policy_password_complexity.go rename to internal/repository/org/policy_password_complexity.go index 38e984cb31..3cf26fedee 100644 --- a/internal/v2/repository/org/policy_password_complexity.go +++ b/internal/repository/org/policy_password_complexity.go @@ -2,10 +2,10 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/org/policy_password_lockout.go b/internal/repository/org/policy_password_lockout.go similarity index 94% rename from internal/v2/repository/org/policy_password_lockout.go rename to internal/repository/org/policy_password_lockout.go index 5a6fc2d0f6..f51c9a0a25 100644 --- a/internal/v2/repository/org/policy_password_lockout.go +++ b/internal/repository/org/policy_password_lockout.go @@ -2,10 +2,10 @@ package org import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/policy" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/policy" ) var ( diff --git a/internal/v2/repository/policy/label.go b/internal/repository/policy/label.go similarity index 96% rename from internal/v2/repository/policy/label.go rename to internal/repository/policy/label.go index 400a6bf025..3558c733c7 100644 --- a/internal/v2/repository/policy/label.go +++ b/internal/repository/policy/label.go @@ -3,8 +3,8 @@ package policy import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/login.go b/internal/repository/policy/login.go similarity index 96% rename from internal/v2/repository/policy/login.go rename to internal/repository/policy/login.go index ae1304609f..dbcfbfe9a7 100644 --- a/internal/v2/repository/policy/login.go +++ b/internal/repository/policy/login.go @@ -2,10 +2,10 @@ package policy import ( "encoding/json" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/mail_template.go b/internal/repository/policy/mail_template.go similarity index 96% rename from internal/v2/repository/policy/mail_template.go rename to internal/repository/policy/mail_template.go index f1a89a6e48..05f68a3f6f 100644 --- a/internal/v2/repository/policy/mail_template.go +++ b/internal/repository/policy/mail_template.go @@ -3,8 +3,8 @@ package policy import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/mail_text.go b/internal/repository/policy/mail_text.go similarity index 98% rename from internal/v2/repository/policy/mail_text.go rename to internal/repository/policy/mail_text.go index bb42deae68..d3e5a1af75 100644 --- a/internal/v2/repository/policy/mail_text.go +++ b/internal/repository/policy/mail_text.go @@ -4,8 +4,8 @@ import ( "encoding/json" "fmt" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/policy_login_factors.go b/internal/repository/policy/policy_login_factors.go similarity index 96% rename from internal/v2/repository/policy/policy_login_factors.go rename to internal/repository/policy/policy_login_factors.go index 02866d3abe..02f4f72959 100644 --- a/internal/v2/repository/policy/policy_login_factors.go +++ b/internal/repository/policy/policy_login_factors.go @@ -2,10 +2,10 @@ package policy import ( "encoding/json" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/policy_login_identity_provider.go b/internal/repository/policy/policy_login_identity_provider.go similarity index 95% rename from internal/v2/repository/policy/policy_login_identity_provider.go rename to internal/repository/policy/policy_login_identity_provider.go index 2b923bdf2c..2d64719944 100644 --- a/internal/v2/repository/policy/policy_login_identity_provider.go +++ b/internal/repository/policy/policy_login_identity_provider.go @@ -2,10 +2,10 @@ package policy import ( "encoding/json" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/policy_org_iam.go b/internal/repository/policy/policy_org_iam.go similarity index 96% rename from internal/v2/repository/policy/policy_org_iam.go rename to internal/repository/policy/policy_org_iam.go index 81cae5c60f..f85895495f 100644 --- a/internal/v2/repository/policy/policy_org_iam.go +++ b/internal/repository/policy/policy_org_iam.go @@ -2,10 +2,10 @@ package policy import ( "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/policy_password_age.go b/internal/repository/policy/policy_password_age.go similarity index 96% rename from internal/v2/repository/policy/policy_password_age.go rename to internal/repository/policy/policy_password_age.go index 0a39dfb4d5..dde9004a3f 100644 --- a/internal/v2/repository/policy/policy_password_age.go +++ b/internal/repository/policy/policy_password_age.go @@ -3,8 +3,8 @@ package policy import ( "encoding/json" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/policy_password_complexity.go b/internal/repository/policy/policy_password_complexity.go similarity index 97% rename from internal/v2/repository/policy/policy_password_complexity.go rename to internal/repository/policy/policy_password_complexity.go index 7053761a7c..b1d65dba86 100644 --- a/internal/v2/repository/policy/policy_password_complexity.go +++ b/internal/repository/policy/policy_password_complexity.go @@ -2,10 +2,10 @@ package policy import ( "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/policy/policy_password_lockout.go b/internal/repository/policy/policy_password_lockout.go similarity index 97% rename from internal/v2/repository/policy/policy_password_lockout.go rename to internal/repository/policy/policy_password_lockout.go index 5bae5ad6f7..fc8c46a2a6 100644 --- a/internal/v2/repository/policy/policy_password_lockout.go +++ b/internal/repository/policy/policy_password_lockout.go @@ -2,10 +2,10 @@ package policy import ( "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/project/aggregate.go b/internal/repository/project/aggregate.go similarity index 74% rename from internal/v2/repository/project/aggregate.go rename to internal/repository/project/aggregate.go index 58a99f6ef2..441c15ab41 100644 --- a/internal/v2/repository/project/aggregate.go +++ b/internal/repository/project/aggregate.go @@ -1,7 +1,7 @@ package project import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) const ( diff --git a/internal/v2/repository/project/api_config.go b/internal/repository/project/api_config.go similarity index 97% rename from internal/v2/repository/project/api_config.go rename to internal/repository/project/api_config.go index 657799b3b3..bffed7e30a 100644 --- a/internal/v2/repository/project/api_config.go +++ b/internal/repository/project/api_config.go @@ -3,12 +3,12 @@ package project import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/project/application.go b/internal/repository/project/application.go similarity index 98% rename from internal/v2/repository/project/application.go rename to internal/repository/project/application.go index 22fe049cc4..45bac6db53 100644 --- a/internal/v2/repository/project/application.go +++ b/internal/repository/project/application.go @@ -4,10 +4,10 @@ import ( "context" "encoding/json" "fmt" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/project/eventstore.go b/internal/repository/project/eventstore.go similarity index 98% rename from internal/v2/repository/project/eventstore.go rename to internal/repository/project/eventstore.go index faf6248272..e57910e2a9 100644 --- a/internal/v2/repository/project/eventstore.go +++ b/internal/repository/project/eventstore.go @@ -1,7 +1,7 @@ package project import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) func RegisterEventMappers(es *eventstore.Eventstore) { diff --git a/internal/v2/repository/project/grant.go b/internal/repository/project/grant.go similarity index 98% rename from internal/v2/repository/project/grant.go rename to internal/repository/project/grant.go index 95b32266dc..48892289c7 100644 --- a/internal/v2/repository/project/grant.go +++ b/internal/repository/project/grant.go @@ -4,10 +4,10 @@ import ( "context" "encoding/json" "fmt" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) var ( diff --git a/internal/v2/repository/project/grant_member.go b/internal/repository/project/grant_member.go similarity index 96% rename from internal/v2/repository/project/grant_member.go rename to internal/repository/project/grant_member.go index 6584858500..67beafd76a 100644 --- a/internal/v2/repository/project/grant_member.go +++ b/internal/repository/project/grant_member.go @@ -4,11 +4,11 @@ import ( "context" "encoding/json" "fmt" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/member" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/member" ) var ( diff --git a/internal/v2/repository/project/key.go b/internal/repository/project/key.go similarity index 94% rename from internal/v2/repository/project/key.go rename to internal/repository/project/key.go index f04b006c05..eff24e1eab 100644 --- a/internal/v2/repository/project/key.go +++ b/internal/repository/project/key.go @@ -3,12 +3,12 @@ package project import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "time" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/project/member.go b/internal/repository/project/member.go similarity index 93% rename from internal/v2/repository/project/member.go rename to internal/repository/project/member.go index 98a3875d1f..03bb6031e0 100644 --- a/internal/v2/repository/project/member.go +++ b/internal/repository/project/member.go @@ -2,10 +2,10 @@ package project import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/repository/member" + "github.com/caos/zitadel/internal/eventstore/repository" + "github.com/caos/zitadel/internal/repository/member" ) var ( diff --git a/internal/v2/repository/project/oidc_config.go b/internal/repository/project/oidc_config.go similarity index 98% rename from internal/v2/repository/project/oidc_config.go rename to internal/repository/project/oidc_config.go index ce4d4942fc..2c2996799b 100644 --- a/internal/v2/repository/project/oidc_config.go +++ b/internal/repository/project/oidc_config.go @@ -3,13 +3,13 @@ package project import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/project/project.go b/internal/repository/project/project.go similarity index 98% rename from internal/v2/repository/project/project.go rename to internal/repository/project/project.go index 8c211e46fe..faba643146 100644 --- a/internal/v2/repository/project/project.go +++ b/internal/repository/project/project.go @@ -3,10 +3,10 @@ package project import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/project/role.go b/internal/repository/project/role.go similarity index 97% rename from internal/v2/repository/project/role.go rename to internal/repository/project/role.go index 4018828a69..e51b3ed3d2 100644 --- a/internal/v2/repository/project/role.go +++ b/internal/repository/project/role.go @@ -4,10 +4,10 @@ import ( "context" "encoding/json" "fmt" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) var ( diff --git a/internal/v2/repository/user/aggregate.go b/internal/repository/user/aggregate.go similarity index 73% rename from internal/v2/repository/user/aggregate.go rename to internal/repository/user/aggregate.go index bf7cf9cf32..8391cf68c3 100644 --- a/internal/v2/repository/user/aggregate.go +++ b/internal/repository/user/aggregate.go @@ -1,7 +1,7 @@ package user import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) const ( diff --git a/internal/v2/repository/user/auth_request_info.go b/internal/repository/user/auth_request_info.go similarity index 100% rename from internal/v2/repository/user/auth_request_info.go rename to internal/repository/user/auth_request_info.go diff --git a/internal/v2/repository/user/eventstore.go b/internal/repository/user/eventstore.go similarity index 99% rename from internal/v2/repository/user/eventstore.go rename to internal/repository/user/eventstore.go index b0758c39eb..c95d98b371 100644 --- a/internal/v2/repository/user/eventstore.go +++ b/internal/repository/user/eventstore.go @@ -1,7 +1,7 @@ package user import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) func RegisterEventMappers(es *eventstore.Eventstore) { diff --git a/internal/v2/repository/user/human.go b/internal/repository/user/human.go similarity index 98% rename from internal/v2/repository/user/human.go rename to internal/repository/user/human.go index 6bb902f020..efc18eca0c 100644 --- a/internal/v2/repository/user/human.go +++ b/internal/repository/user/human.go @@ -3,13 +3,13 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" "golang.org/x/text/language" ) diff --git a/internal/v2/repository/user/human_address.go b/internal/repository/user/human_address.go similarity index 92% rename from internal/v2/repository/user/human_address.go rename to internal/repository/user/human_address.go index b4e6dbddcc..934609b5ab 100644 --- a/internal/v2/repository/user/human_address.go +++ b/internal/repository/user/human_address.go @@ -3,10 +3,10 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_email.go b/internal/repository/user/human_email.go similarity index 97% rename from internal/v2/repository/user/human_email.go rename to internal/repository/user/human_email.go index 110c1d6e76..7765c5dc67 100644 --- a/internal/v2/repository/user/human_email.go +++ b/internal/repository/user/human_email.go @@ -3,12 +3,12 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_external_idp.go b/internal/repository/user/human_external_idp.go similarity index 98% rename from internal/v2/repository/user/human_external_idp.go rename to internal/repository/user/human_external_idp.go index 7cbba694e3..029412a3d4 100644 --- a/internal/v2/repository/user/human_external_idp.go +++ b/internal/repository/user/human_external_idp.go @@ -3,10 +3,10 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_mfa_events.go b/internal/repository/user/human_mfa_events.go similarity index 88% rename from internal/v2/repository/user/human_mfa_events.go rename to internal/repository/user/human_mfa_events.go index e158dc52cb..9728efc9db 100644 --- a/internal/v2/repository/user/human_mfa_events.go +++ b/internal/repository/user/human_mfa_events.go @@ -2,9 +2,9 @@ package user import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_mfa_otp.go b/internal/repository/user/human_mfa_otp.go similarity index 97% rename from internal/v2/repository/user/human_mfa_otp.go rename to internal/repository/user/human_mfa_otp.go index 2d1ab31ec2..6b4e61573a 100644 --- a/internal/v2/repository/user/human_mfa_otp.go +++ b/internal/repository/user/human_mfa_otp.go @@ -3,11 +3,11 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_mfa_passwordless.go b/internal/repository/user/human_mfa_passwordless.go similarity index 98% rename from internal/v2/repository/user/human_mfa_passwordless.go rename to internal/repository/user/human_mfa_passwordless.go index ec5a7ce7d2..aeffad1d84 100644 --- a/internal/v2/repository/user/human_mfa_passwordless.go +++ b/internal/repository/user/human_mfa_passwordless.go @@ -2,9 +2,9 @@ package user import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_mfa_u2f.go b/internal/repository/user/human_mfa_u2f.go similarity index 98% rename from internal/v2/repository/user/human_mfa_u2f.go rename to internal/repository/user/human_mfa_u2f.go index ddfa74ce56..530431fa4b 100644 --- a/internal/v2/repository/user/human_mfa_u2f.go +++ b/internal/repository/user/human_mfa_u2f.go @@ -2,9 +2,9 @@ package user import ( "context" + "github.com/caos/zitadel/internal/eventstore" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_mfa_web_auth_n.go b/internal/repository/user/human_mfa_web_auth_n.go similarity index 97% rename from internal/v2/repository/user/human_mfa_web_auth_n.go rename to internal/repository/user/human_mfa_web_auth_n.go index 7f6bbf3758..19a928f81f 100644 --- a/internal/v2/repository/user/human_mfa_web_auth_n.go +++ b/internal/repository/user/human_mfa_web_auth_n.go @@ -2,10 +2,10 @@ package user import ( "encoding/json" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/eventstore/repository" ) type HumanWebAuthNAddedEvent struct { diff --git a/internal/v2/repository/user/human_password.go b/internal/repository/user/human_password.go similarity index 97% rename from internal/v2/repository/user/human_password.go rename to internal/repository/user/human_password.go index bf551e0016..3c67ad0e14 100644 --- a/internal/v2/repository/user/human_password.go +++ b/internal/repository/user/human_password.go @@ -3,13 +3,13 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_phone.go b/internal/repository/user/human_phone.go similarity index 98% rename from internal/v2/repository/user/human_phone.go rename to internal/repository/user/human_phone.go index 4651bdc74c..1643a6ebc3 100644 --- a/internal/v2/repository/user/human_phone.go +++ b/internal/repository/user/human_phone.go @@ -3,12 +3,12 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/human_profile.go b/internal/repository/user/human_profile.go similarity index 90% rename from internal/v2/repository/user/human_profile.go rename to internal/repository/user/human_profile.go index c3de588e82..2f5f8f9629 100644 --- a/internal/v2/repository/user/human_profile.go +++ b/internal/repository/user/human_profile.go @@ -3,11 +3,11 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" "golang.org/x/text/language" ) diff --git a/internal/v2/repository/user/machine.go b/internal/repository/user/machine.go similarity index 95% rename from internal/v2/repository/user/machine.go rename to internal/repository/user/machine.go index d0cc2ecdd9..9e067cb327 100644 --- a/internal/v2/repository/user/machine.go +++ b/internal/repository/user/machine.go @@ -3,10 +3,10 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/machine_key.go b/internal/repository/user/machine_key.go similarity index 94% rename from internal/v2/repository/user/machine_key.go rename to internal/repository/user/machine_key.go index 840c7848eb..d000226b3d 100644 --- a/internal/v2/repository/user/machine_key.go +++ b/internal/repository/user/machine_key.go @@ -3,12 +3,12 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "time" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/user.go b/internal/repository/user/user.go similarity index 98% rename from internal/v2/repository/user/user.go rename to internal/repository/user/user.go index 79cc737c97..a7a6c8d14d 100644 --- a/internal/v2/repository/user/user.go +++ b/internal/repository/user/user.go @@ -3,11 +3,11 @@ package user import ( "context" "encoding/json" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/v2/repository/user/v1.go b/internal/repository/user/v1.go similarity index 99% rename from internal/v2/repository/user/v1.go rename to internal/repository/user/v1.go index 589b79205b..3fee14fd94 100644 --- a/internal/v2/repository/user/v1.go +++ b/internal/repository/user/v1.go @@ -2,11 +2,11 @@ package user import ( "context" + "github.com/caos/zitadel/internal/eventstore" "time" "github.com/caos/zitadel/internal/crypto" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "golang.org/x/text/language" ) diff --git a/internal/v2/repository/usergrant/aggregate.go b/internal/repository/usergrant/aggregate.go similarity index 74% rename from internal/v2/repository/usergrant/aggregate.go rename to internal/repository/usergrant/aggregate.go index 93a89e4224..68fa1f0c78 100644 --- a/internal/v2/repository/usergrant/aggregate.go +++ b/internal/repository/usergrant/aggregate.go @@ -1,7 +1,7 @@ package usergrant import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) const ( diff --git a/internal/v2/repository/usergrant/eventstore.go b/internal/repository/usergrant/eventstore.go similarity index 93% rename from internal/v2/repository/usergrant/eventstore.go rename to internal/repository/usergrant/eventstore.go index c79222aa01..647db86a09 100644 --- a/internal/v2/repository/usergrant/eventstore.go +++ b/internal/repository/usergrant/eventstore.go @@ -1,7 +1,7 @@ package usergrant import ( - "github.com/caos/zitadel/internal/eventstore/v2" + "github.com/caos/zitadel/internal/eventstore" ) func RegisterEventMappers(es *eventstore.Eventstore) { diff --git a/internal/v2/repository/usergrant/user_grant.go b/internal/repository/usergrant/user_grant.go similarity index 98% rename from internal/v2/repository/usergrant/user_grant.go rename to internal/repository/usergrant/user_grant.go index 3ef3558e45..d54dd2c7a6 100644 --- a/internal/v2/repository/usergrant/user_grant.go +++ b/internal/repository/usergrant/user_grant.go @@ -4,10 +4,10 @@ import ( "context" "encoding/json" "fmt" + "github.com/caos/zitadel/internal/eventstore" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/eventstore/v2/repository" + "github.com/caos/zitadel/internal/eventstore/repository" ) const ( diff --git a/internal/setup/config.go b/internal/setup/config.go index b2f8d25374..95b2856d55 100644 --- a/internal/setup/config.go +++ b/internal/setup/config.go @@ -1,8 +1,8 @@ package setup import ( - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/domain" ) type IAMSetUp struct { diff --git a/internal/setup/setup.go b/internal/setup/setup.go index d46aac031d..f48f95db28 100644 --- a/internal/setup/setup.go +++ b/internal/setup/setup.go @@ -5,10 +5,10 @@ import ( "github.com/caos/logging" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/domain" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/eventstore/v1/models" ) const ( diff --git a/internal/ui/login/handler/auth_request.go b/internal/ui/login/handler/auth_request.go index 24e44eb606..693bd6cdbc 100644 --- a/internal/ui/login/handler/auth_request.go +++ b/internal/ui/login/handler/auth_request.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/callback_handler.go b/internal/ui/login/handler/callback_handler.go index 1cdbab83e0..0877c31911 100644 --- a/internal/ui/login/handler/callback_handler.go +++ b/internal/ui/login/handler/callback_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" ) diff --git a/internal/ui/login/handler/change_password_handler.go b/internal/ui/login/handler/change_password_handler.go index 88167dbe1a..3987fe3051 100644 --- a/internal/ui/login/handler/change_password_handler.go +++ b/internal/ui/login/handler/change_password_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/external_login_handler.go b/internal/ui/login/handler/external_login_handler.go index 789d1d905e..47bd938260 100644 --- a/internal/ui/login/handler/external_login_handler.go +++ b/internal/ui/login/handler/external_login_handler.go @@ -5,10 +5,10 @@ import ( "github.com/caos/oidc/pkg/oidc" http_mw "github.com/caos/zitadel/internal/api/http/middleware" "github.com/caos/zitadel/internal/crypto" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" caos_errors "github.com/caos/zitadel/internal/errors" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" "net/http" "strings" "time" diff --git a/internal/ui/login/handler/external_register_handler.go b/internal/ui/login/handler/external_register_handler.go index 4d5f63accf..ab805f573d 100644 --- a/internal/ui/login/handler/external_register_handler.go +++ b/internal/ui/login/handler/external_register_handler.go @@ -8,9 +8,9 @@ import ( "github.com/caos/oidc/pkg/oidc" http_mw "github.com/caos/zitadel/internal/api/http/middleware" + "github.com/caos/zitadel/internal/domain" caos_errors "github.com/caos/zitadel/internal/errors" iam_model "github.com/caos/zitadel/internal/iam/model" - "github.com/caos/zitadel/internal/v2/domain" ) func (l *Login) handleExternalRegister(w http.ResponseWriter, r *http.Request) { diff --git a/internal/ui/login/handler/init_password_handler.go b/internal/ui/login/handler/init_password_handler.go index 7348babf15..c938d1f1ae 100644 --- a/internal/ui/login/handler/init_password_handler.go +++ b/internal/ui/login/handler/init_password_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/init_user_handler.go b/internal/ui/login/handler/init_user_handler.go index 94e9485c41..8c006e75a5 100644 --- a/internal/ui/login/handler/init_user_handler.go +++ b/internal/ui/login/handler/init_user_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" "strconv" diff --git a/internal/ui/login/handler/link_users_handler.go b/internal/ui/login/handler/link_users_handler.go index c1ca76a934..6e4d4dcec2 100644 --- a/internal/ui/login/handler/link_users_handler.go +++ b/internal/ui/login/handler/link_users_handler.go @@ -2,7 +2,7 @@ package handler import ( http_mw "github.com/caos/zitadel/internal/api/http/middleware" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" ) diff --git a/internal/ui/login/handler/login.go b/internal/ui/login/handler/login.go index f8cdb5ee1c..2cd669dc92 100644 --- a/internal/ui/login/handler/login.go +++ b/internal/ui/login/handler/login.go @@ -2,8 +2,8 @@ package handler import ( "context" - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/query" + "github.com/caos/zitadel/internal/command" + "github.com/caos/zitadel/internal/query" "net" "net/http" diff --git a/internal/ui/login/handler/login_handler.go b/internal/ui/login/handler/login_handler.go index bb7d3c2a66..f4de584dfe 100644 --- a/internal/ui/login/handler/login_handler.go +++ b/internal/ui/login/handler/login_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/mail_verify_handler.go b/internal/ui/login/handler/mail_verify_handler.go index 58f81f96c4..b0cec21c13 100644 --- a/internal/ui/login/handler/mail_verify_handler.go +++ b/internal/ui/login/handler/mail_verify_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" ) diff --git a/internal/ui/login/handler/mfa_init_done_handler.go b/internal/ui/login/handler/mfa_init_done_handler.go index 01509935ac..f1f189c0fb 100644 --- a/internal/ui/login/handler/mfa_init_done_handler.go +++ b/internal/ui/login/handler/mfa_init_done_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" ) diff --git a/internal/ui/login/handler/mfa_init_u2f.go b/internal/ui/login/handler/mfa_init_u2f.go index 370d062413..6a96d0406f 100644 --- a/internal/ui/login/handler/mfa_init_u2f.go +++ b/internal/ui/login/handler/mfa_init_u2f.go @@ -2,7 +2,7 @@ package handler import ( "encoding/base64" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/mfa_init_verify_handler.go b/internal/ui/login/handler/mfa_init_verify_handler.go index 888b4b828f..1292951b7b 100644 --- a/internal/ui/login/handler/mfa_init_verify_handler.go +++ b/internal/ui/login/handler/mfa_init_verify_handler.go @@ -2,7 +2,7 @@ package handler import ( "bytes" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" svg "github.com/ajstarks/svgo" diff --git a/internal/ui/login/handler/mfa_prompt_handler.go b/internal/ui/login/handler/mfa_prompt_handler.go index e42508c907..54bf3bb83e 100644 --- a/internal/ui/login/handler/mfa_prompt_handler.go +++ b/internal/ui/login/handler/mfa_prompt_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" caos_errs "github.com/caos/zitadel/internal/errors" diff --git a/internal/ui/login/handler/mfa_verify_handler.go b/internal/ui/login/handler/mfa_verify_handler.go index fee297b963..528a05e31c 100644 --- a/internal/ui/login/handler/mfa_verify_handler.go +++ b/internal/ui/login/handler/mfa_verify_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/mfa_verify_u2f_handler.go b/internal/ui/login/handler/mfa_verify_u2f_handler.go index d8261b2814..25f2f724ed 100644 --- a/internal/ui/login/handler/mfa_verify_u2f_handler.go +++ b/internal/ui/login/handler/mfa_verify_u2f_handler.go @@ -2,7 +2,7 @@ package handler import ( "encoding/base64" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/password_handler.go b/internal/ui/login/handler/password_handler.go index 5cfd0a6a38..91a07ffd52 100644 --- a/internal/ui/login/handler/password_handler.go +++ b/internal/ui/login/handler/password_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/password_reset_handler.go b/internal/ui/login/handler/password_reset_handler.go index 359598491c..7a4d360999 100644 --- a/internal/ui/login/handler/password_reset_handler.go +++ b/internal/ui/login/handler/password_reset_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" ) diff --git a/internal/ui/login/handler/passwordless_login_handler.go b/internal/ui/login/handler/passwordless_login_handler.go index 597ea7c325..889d1cbc1e 100644 --- a/internal/ui/login/handler/passwordless_login_handler.go +++ b/internal/ui/login/handler/passwordless_login_handler.go @@ -2,7 +2,7 @@ package handler import ( "encoding/base64" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/register_handler.go b/internal/ui/login/handler/register_handler.go index 890956a5a0..480d22689a 100644 --- a/internal/ui/login/handler/register_handler.go +++ b/internal/ui/login/handler/register_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" "golang.org/x/text/language" diff --git a/internal/ui/login/handler/register_option_handler.go b/internal/ui/login/handler/register_option_handler.go index c3ad5e8399..e86389542d 100644 --- a/internal/ui/login/handler/register_option_handler.go +++ b/internal/ui/login/handler/register_option_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" ) diff --git a/internal/ui/login/handler/register_org_handler.go b/internal/ui/login/handler/register_org_handler.go index b61e75d9f7..ced56aa6b7 100644 --- a/internal/ui/login/handler/register_org_handler.go +++ b/internal/ui/login/handler/register_org_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" caos_errs "github.com/caos/zitadel/internal/errors" diff --git a/internal/ui/login/handler/renderer.go b/internal/ui/login/handler/renderer.go index e80ea1304c..469f73e567 100644 --- a/internal/ui/login/handler/renderer.go +++ b/internal/ui/login/handler/renderer.go @@ -3,7 +3,7 @@ package handler import ( "errors" "fmt" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "html/template" "net/http" "path" diff --git a/internal/ui/login/handler/select_user_handler.go b/internal/ui/login/handler/select_user_handler.go index c30319d53d..29c4fd0691 100644 --- a/internal/ui/login/handler/select_user_handler.go +++ b/internal/ui/login/handler/select_user_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" http_mw "github.com/caos/zitadel/internal/api/http/middleware" diff --git a/internal/ui/login/handler/username_change_handler.go b/internal/ui/login/handler/username_change_handler.go index de7bbf60b3..c0e237b8ec 100644 --- a/internal/ui/login/handler/username_change_handler.go +++ b/internal/ui/login/handler/username_change_handler.go @@ -1,7 +1,7 @@ package handler import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "net/http" ) diff --git a/internal/ui/login/login.go b/internal/ui/login/login.go index 4d4cbbbd84..effa78348e 100644 --- a/internal/ui/login/login.go +++ b/internal/ui/login/login.go @@ -2,10 +2,10 @@ package login import ( "github.com/caos/zitadel/internal/auth/repository/eventsourcing" + "github.com/caos/zitadel/internal/command" "github.com/caos/zitadel/internal/config/systemdefaults" + "github.com/caos/zitadel/internal/query" "github.com/caos/zitadel/internal/ui/login/handler" - "github.com/caos/zitadel/internal/v2/command" - "github.com/caos/zitadel/internal/v2/query" ) type Config struct { diff --git a/internal/user/model/address.go b/internal/user/model/address.go index 7c721d07dc..2bec01a4da 100644 --- a/internal/user/model/address.go +++ b/internal/user/model/address.go @@ -1,6 +1,6 @@ package model -import es_models "github.com/caos/zitadel/internal/eventstore/models" +import es_models "github.com/caos/zitadel/internal/eventstore/v1/models" type Address struct { es_models.ObjectRoot diff --git a/internal/user/model/email.go b/internal/user/model/email.go index eb0bd1380f..80f65a33fd 100644 --- a/internal/user/model/email.go +++ b/internal/user/model/email.go @@ -2,7 +2,7 @@ package model import ( "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "time" ) diff --git a/internal/user/model/external_idp.go b/internal/user/model/external_idp.go index 2c67f9d495..d30b505cf7 100644 --- a/internal/user/model/external_idp.go +++ b/internal/user/model/external_idp.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type ExternalIDP struct { diff --git a/internal/user/model/password.go b/internal/user/model/password.go index 9762dade2f..0efd62dc21 100644 --- a/internal/user/model/password.go +++ b/internal/user/model/password.go @@ -3,7 +3,7 @@ package model import ( "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "time" ) diff --git a/internal/user/model/phone.go b/internal/user/model/phone.go index a6f93b237c..77dd0a5027 100644 --- a/internal/user/model/phone.go +++ b/internal/user/model/phone.go @@ -3,7 +3,7 @@ package model import ( "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/ttacon/libphonenumber" "time" ) diff --git a/internal/user/model/profile.go b/internal/user/model/profile.go index 485d228e22..216cefc734 100644 --- a/internal/user/model/profile.go +++ b/internal/user/model/profile.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "golang.org/x/text/language" ) diff --git a/internal/user/model/token.go b/internal/user/model/token.go index 02113552ea..1d5ca69c52 100644 --- a/internal/user/model/token.go +++ b/internal/user/model/token.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "time" ) diff --git a/internal/user/model/user_view.go b/internal/user/model/user_view.go index f75aae7afc..3635df6cfe 100644 --- a/internal/user/model/user_view.go +++ b/internal/user/model/user_view.go @@ -1,14 +1,14 @@ package model import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "time" "golang.org/x/text/language" req_model "github.com/caos/zitadel/internal/auth_request/model" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" "github.com/caos/zitadel/internal/model" ) diff --git a/internal/user/repository/eventsourcing/model/address.go b/internal/user/repository/eventsourcing/model/address.go index 3888d06a4e..968f17bfa0 100644 --- a/internal/user/repository/eventsourcing/model/address.go +++ b/internal/user/repository/eventsourcing/model/address.go @@ -5,7 +5,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/address_test.go b/internal/user/repository/eventsourcing/model/address_test.go index 9339482abe..bd693c5a24 100644 --- a/internal/user/repository/eventsourcing/model/address_test.go +++ b/internal/user/repository/eventsourcing/model/address_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestAddressChanges(t *testing.T) { diff --git a/internal/user/repository/eventsourcing/model/auth_request.go b/internal/user/repository/eventsourcing/model/auth_request.go index 436199c89d..9340450e84 100644 --- a/internal/user/repository/eventsourcing/model/auth_request.go +++ b/internal/user/repository/eventsourcing/model/auth_request.go @@ -4,7 +4,7 @@ import ( "encoding/json" "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "net" "github.com/caos/zitadel/internal/auth_request/model" diff --git a/internal/user/repository/eventsourcing/model/email.go b/internal/user/repository/eventsourcing/model/email.go index 6575c4655e..cf69fb4248 100644 --- a/internal/user/repository/eventsourcing/model/email.go +++ b/internal/user/repository/eventsourcing/model/email.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/email_test.go b/internal/user/repository/eventsourcing/model/email_test.go index 861796d162..a4ae8221d8 100644 --- a/internal/user/repository/eventsourcing/model/email_test.go +++ b/internal/user/repository/eventsourcing/model/email_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestEmailChanges(t *testing.T) { diff --git a/internal/user/repository/eventsourcing/model/external_idp.go b/internal/user/repository/eventsourcing/model/external_idp.go index c3e46f5c5c..82b699d3be 100644 --- a/internal/user/repository/eventsourcing/model/external_idp.go +++ b/internal/user/repository/eventsourcing/model/external_idp.go @@ -4,7 +4,7 @@ import ( "encoding/json" "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/external_idp_test.go b/internal/user/repository/eventsourcing/model/external_idp_test.go index c9e6ecec55..434d8a3a58 100644 --- a/internal/user/repository/eventsourcing/model/external_idp_test.go +++ b/internal/user/repository/eventsourcing/model/external_idp_test.go @@ -2,7 +2,7 @@ package model import ( "encoding/json" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "testing" ) diff --git a/internal/user/repository/eventsourcing/model/otp.go b/internal/user/repository/eventsourcing/model/otp.go index 772857f8ee..d07638d8a3 100644 --- a/internal/user/repository/eventsourcing/model/otp.go +++ b/internal/user/repository/eventsourcing/model/otp.go @@ -6,7 +6,7 @@ import ( "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/otp_test.go b/internal/user/repository/eventsourcing/model/otp_test.go index 6cbf817262..392846e5d7 100644 --- a/internal/user/repository/eventsourcing/model/otp_test.go +++ b/internal/user/repository/eventsourcing/model/otp_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/password.go b/internal/user/repository/eventsourcing/model/password.go index 033cf8154b..55011db6d3 100644 --- a/internal/user/repository/eventsourcing/model/password.go +++ b/internal/user/repository/eventsourcing/model/password.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/password_test.go b/internal/user/repository/eventsourcing/model/password_test.go index e6b01a2e0a..c9ddc513d2 100644 --- a/internal/user/repository/eventsourcing/model/password_test.go +++ b/internal/user/repository/eventsourcing/model/password_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestAppendUserPasswordChangedEvent(t *testing.T) { diff --git a/internal/user/repository/eventsourcing/model/phone.go b/internal/user/repository/eventsourcing/model/phone.go index 0515923029..bc589eadaf 100644 --- a/internal/user/repository/eventsourcing/model/phone.go +++ b/internal/user/repository/eventsourcing/model/phone.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/phone_test.go b/internal/user/repository/eventsourcing/model/phone_test.go index 432c2a501c..dd13191b07 100644 --- a/internal/user/repository/eventsourcing/model/phone_test.go +++ b/internal/user/repository/eventsourcing/model/phone_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestPhoneChanges(t *testing.T) { diff --git a/internal/user/repository/eventsourcing/model/profile.go b/internal/user/repository/eventsourcing/model/profile.go index 77c1f6c57f..ee239ef719 100644 --- a/internal/user/repository/eventsourcing/model/profile.go +++ b/internal/user/repository/eventsourcing/model/profile.go @@ -5,7 +5,7 @@ import ( "golang.org/x/text/language" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/token.go b/internal/user/repository/eventsourcing/model/token.go index d562cece7e..97d94818a8 100644 --- a/internal/user/repository/eventsourcing/model/token.go +++ b/internal/user/repository/eventsourcing/model/token.go @@ -6,7 +6,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/types.go b/internal/user/repository/eventsourcing/model/types.go index c67b09fe25..60b37acbbe 100644 --- a/internal/user/repository/eventsourcing/model/types.go +++ b/internal/user/repository/eventsourcing/model/types.go @@ -1,6 +1,6 @@ package model -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" //aggregates const ( diff --git a/internal/user/repository/eventsourcing/model/user.go b/internal/user/repository/eventsourcing/model/user.go index bf6ff180f7..80c1a4ce3f 100644 --- a/internal/user/repository/eventsourcing/model/user.go +++ b/internal/user/repository/eventsourcing/model/user.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/user_human.go b/internal/user/repository/eventsourcing/model/user_human.go index d1438a0688..6b3d2eb008 100644 --- a/internal/user/repository/eventsourcing/model/user_human.go +++ b/internal/user/repository/eventsourcing/model/user_human.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/crypto" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/user_machine.go b/internal/user/repository/eventsourcing/model/user_machine.go index 5346e3e65a..ddd0cb3457 100644 --- a/internal/user/repository/eventsourcing/model/user_machine.go +++ b/internal/user/repository/eventsourcing/model/user_machine.go @@ -6,8 +6,7 @@ import ( "github.com/caos/logging" "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type Machine struct { @@ -17,7 +16,7 @@ type Machine struct { Description string `json:"description,omitempty"` } -func (sa *Machine) AppendEvents(events ...*models.Event) error { +func (sa *Machine) AppendEvents(events ...*es_models.Event) error { for _, event := range events { if err := sa.AppendEvent(event); err != nil { return err @@ -26,7 +25,7 @@ func (sa *Machine) AppendEvents(events ...*models.Event) error { return nil } -func (sa *Machine) AppendEvent(event *models.Event) (err error) { +func (sa *Machine) AppendEvent(event *es_models.Event) (err error) { switch event.Type { case MachineAdded, MachineChanged: err = sa.setData(event) @@ -35,7 +34,7 @@ func (sa *Machine) AppendEvent(event *models.Event) (err error) { return err } -func (sa *Machine) setData(event *models.Event) error { +func (sa *Machine) setData(event *es_models.Event) error { if err := json.Unmarshal(event.Data, sa); err != nil { logging.Log("EVEN-8ujgd").WithError(err).Error("could not unmarshal event data") return errors.ThrowInternal(err, "MODEL-GwjY9", "could not unmarshal event") diff --git a/internal/user/repository/eventsourcing/model/web_auth_n.go b/internal/user/repository/eventsourcing/model/web_auth_n.go index 8a5e5e5411..9d788043ff 100644 --- a/internal/user/repository/eventsourcing/model/web_auth_n.go +++ b/internal/user/repository/eventsourcing/model/web_auth_n.go @@ -6,7 +6,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" ) diff --git a/internal/user/repository/eventsourcing/model/web_auth_n_test.go b/internal/user/repository/eventsourcing/model/web_auth_n_test.go index b4b82b1bab..1a2495567d 100644 --- a/internal/user/repository/eventsourcing/model/web_auth_n_test.go +++ b/internal/user/repository/eventsourcing/model/web_auth_n_test.go @@ -5,7 +5,7 @@ import ( "github.com/caos/zitadel/pkg/grpc/auth" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) func TestAppendMFAU2FAddedEvent(t *testing.T) { diff --git a/internal/user/repository/view/model/external_idps.go b/internal/user/repository/view/model/external_idps.go index 5ed8b0532d..4aa0619ca0 100644 --- a/internal/user/repository/view/model/external_idps.go +++ b/internal/user/repository/view/model/external_idps.go @@ -4,7 +4,7 @@ import ( "encoding/json" "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" "time" diff --git a/internal/user/repository/view/model/notify_user.go b/internal/user/repository/view/model/notify_user.go index 6740febdbc..31060f88f7 100644 --- a/internal/user/repository/view/model/notify_user.go +++ b/internal/user/repository/view/model/notify_user.go @@ -7,7 +7,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" org_model "github.com/caos/zitadel/internal/org/model" "github.com/caos/zitadel/internal/user/model" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" diff --git a/internal/user/repository/view/model/notify_user_test.go b/internal/user/repository/view/model/notify_user_test.go index ff0b8a993d..3b4a033638 100644 --- a/internal/user/repository/view/model/notify_user_test.go +++ b/internal/user/repository/view/model/notify_user_test.go @@ -3,7 +3,7 @@ package model import ( "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" ) diff --git a/internal/user/repository/view/model/token.go b/internal/user/repository/view/model/token.go index 24906d2a56..dd40348dc2 100644 --- a/internal/user/repository/view/model/token.go +++ b/internal/user/repository/view/model/token.go @@ -7,8 +7,7 @@ import ( "github.com/caos/logging" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" usr_model "github.com/caos/zitadel/internal/user/model" usr_es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" @@ -74,7 +73,7 @@ func TokenViewToModel(token *TokenView) *usr_model.TokenView { } } -func (t *TokenView) AppendEventIfMyToken(event *models.Event) (err error) { +func (t *TokenView) AppendEventIfMyToken(event *es_models.Event) (err error) { view := new(TokenView) switch event.Type { case usr_es_model.UserTokenAdded: @@ -115,7 +114,7 @@ func (t *TokenView) AppendEvent(event *es_models.Event) error { return nil } -func (t *TokenView) setRootData(event *models.Event) { +func (t *TokenView) setRootData(event *es_models.Event) { t.UserID = event.AggregateID t.ResourceOwner = event.ResourceOwner } diff --git a/internal/user/repository/view/model/user.go b/internal/user/repository/view/model/user.go index d98b89fdfa..8648c8d85b 100644 --- a/internal/user/repository/view/model/user.go +++ b/internal/user/repository/view/model/user.go @@ -10,7 +10,7 @@ import ( req_model "github.com/caos/zitadel/internal/auth_request/model" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_model "github.com/caos/zitadel/internal/iam/model" org_model "github.com/caos/zitadel/internal/org/model" "github.com/caos/zitadel/internal/user/model" diff --git a/internal/user/repository/view/model/user_membership.go b/internal/user/repository/view/model/user_membership.go index 584c67b7bd..9db1512a14 100644 --- a/internal/user/repository/view/model/user_membership.go +++ b/internal/user/repository/view/model/user_membership.go @@ -8,7 +8,7 @@ import ( "github.com/lib/pq" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model" org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model" proj_es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model" diff --git a/internal/user/repository/view/model/user_session.go b/internal/user/repository/view/model/user_session.go index b64fb1b303..541b7eff45 100644 --- a/internal/user/repository/view/model/user_session.go +++ b/internal/user/repository/view/model/user_session.go @@ -8,7 +8,7 @@ import ( req_model "github.com/caos/zitadel/internal/auth_request/model" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" ) diff --git a/internal/user/repository/view/model/user_session_test.go b/internal/user/repository/view/model/user_session_test.go index c5abd6a958..10ccb0646e 100644 --- a/internal/user/repository/view/model/user_session_test.go +++ b/internal/user/repository/view/model/user_session_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" ) diff --git a/internal/user/repository/view/model/user_test.go b/internal/user/repository/view/model/user_test.go index 41e91203cd..d067b1cd02 100644 --- a/internal/user/repository/view/model/user_test.go +++ b/internal/user/repository/view/model/user_test.go @@ -6,7 +6,7 @@ import ( "time" "github.com/caos/zitadel/internal/crypto" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/model" es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" ) diff --git a/internal/user/repository/view/query.go b/internal/user/repository/view/query.go index 6f59186834..6f19f5c4d3 100644 --- a/internal/user/repository/view/query.go +++ b/internal/user/repository/view/query.go @@ -2,7 +2,7 @@ package view import ( "github.com/caos/zitadel/internal/errors" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" ) diff --git a/internal/usergrant/repository/eventsourcing/model/types.go b/internal/usergrant/repository/eventsourcing/model/types.go index 66773d1a9d..5ae07738e9 100644 --- a/internal/usergrant/repository/eventsourcing/model/types.go +++ b/internal/usergrant/repository/eventsourcing/model/types.go @@ -1,6 +1,6 @@ package model -import "github.com/caos/zitadel/internal/eventstore/models" +import "github.com/caos/zitadel/internal/eventstore/v1/models" const ( UserGrantAggregate models.AggregateType = "usergrant" diff --git a/internal/usergrant/repository/eventsourcing/model/user_grant.go b/internal/usergrant/repository/eventsourcing/model/user_grant.go index 2376f5a89c..be65e52ef2 100644 --- a/internal/usergrant/repository/eventsourcing/model/user_grant.go +++ b/internal/usergrant/repository/eventsourcing/model/user_grant.go @@ -1,7 +1,7 @@ package model import ( - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" ) type UserGrant struct { diff --git a/internal/usergrant/repository/view/model/user_grant.go b/internal/usergrant/repository/view/model/user_grant.go index 626ab0e616..48ce0fc061 100644 --- a/internal/usergrant/repository/view/model/user_grant.go +++ b/internal/usergrant/repository/view/model/user_grant.go @@ -8,7 +8,7 @@ import ( "github.com/lib/pq" caos_errs "github.com/caos/zitadel/internal/errors" - "github.com/caos/zitadel/internal/eventstore/models" + "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/usergrant/model" es_model "github.com/caos/zitadel/internal/usergrant/repository/eventsourcing/model" ) diff --git a/internal/usergrant/repository/view/model/user_grant_test.go b/internal/usergrant/repository/view/model/user_grant_test.go index ca2cd75b40..8cd32381e6 100644 --- a/internal/usergrant/repository/view/model/user_grant_test.go +++ b/internal/usergrant/repository/view/model/user_grant_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - es_models "github.com/caos/zitadel/internal/eventstore/models" + es_models "github.com/caos/zitadel/internal/eventstore/v1/models" "github.com/caos/zitadel/internal/usergrant/model" es_model "github.com/caos/zitadel/internal/usergrant/repository/eventsourcing/model" "github.com/lib/pq" diff --git a/internal/v2/view/iam.go b/internal/v2/view/iam.go deleted file mode 100644 index 8232e50355..0000000000 --- a/internal/v2/view/iam.go +++ /dev/null @@ -1,44 +0,0 @@ -package view - -import ( - "github.com/caos/zitadel/internal/eventstore/v2" - "github.com/caos/zitadel/internal/v2/domain" - "github.com/caos/zitadel/internal/v2/repository/iam" -) - -type IAM struct { - eventstore.ReadModel - - SetUpStarted domain.Step - SetUpDone domain.Step - - GlobalOrgID string - ProjectID string - - // TODO: how to implement queries? -} - -func (rm *IAM) AppendEvents(events ...eventstore.EventReader) { - rm.ReadModel.AppendEvents(events...) -} - -//Reduce implements eventstore.IAMMemberReadModel -// -func (rm *IAM) Reduce() (err error) { - for _, event := range rm.Events { - switch e := event.(type) { - case *iam.ProjectSetEvent: - rm.ProjectID = e.ProjectID - case *iam.GlobalOrgSetEvent: - rm.GlobalOrgID = e.OrgID - case *iam.SetupStepEvent: - if e.Done { - rm.SetUpDone = e.Step - } else { - rm.SetUpStarted = e.Step - } - } - } - return rm.ReadModel.Reduce() - //execute all queries -} diff --git a/internal/webauthn/converter.go b/internal/webauthn/converter.go index bac6d98374..05d04cace0 100644 --- a/internal/webauthn/converter.go +++ b/internal/webauthn/converter.go @@ -1,7 +1,7 @@ package webauthn import ( - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "github.com/duo-labs/webauthn/protocol" "github.com/duo-labs/webauthn/webauthn" ) diff --git a/internal/webauthn/webauthn.go b/internal/webauthn/webauthn.go index ca4e427b14..7d8db3771c 100644 --- a/internal/webauthn/webauthn.go +++ b/internal/webauthn/webauthn.go @@ -3,7 +3,7 @@ package webauthn import ( "bytes" "encoding/json" - "github.com/caos/zitadel/internal/v2/domain" + "github.com/caos/zitadel/internal/domain" "github.com/duo-labs/webauthn/protocol" "github.com/duo-labs/webauthn/webauthn"