diff --git a/internal/command/iam_idp_config_test.go b/internal/command/iam_idp_config_test.go index 86fced7d52..d56dcbf7aa 100644 --- a/internal/command/iam_idp_config_test.go +++ b/internal/command/iam_idp_config_test.go @@ -88,6 +88,7 @@ func TestCommandSide_AddDefaultIDPConfig(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(idpconfig.NewAddIDPConfigNameUniqueConstraint("name1", "IAM")), ), ), @@ -234,6 +235,7 @@ func TestCommandSide_ChangeDefaultIDPConfig(t *testing.T) { newDefaultIDPConfigChangedEvent(context.Background(), "config1", "name1", "name2", domain.IDPConfigStylingTypeUnspecified), ), }, + nil, uniqueConstraintsFromEventConstraint(idpconfig.NewRemoveIDPConfigNameUniqueConstraint("name1", "IAM")), uniqueConstraintsFromEventConstraint(idpconfig.NewAddIDPConfigNameUniqueConstraint("name2", "IAM")), ), diff --git a/internal/command/iam_idp_oidc_config_test.go b/internal/command/iam_idp_oidc_config_test.go index 479b417f17..63f9acb413 100644 --- a/internal/command/iam_idp_oidc_config_test.go +++ b/internal/command/iam_idp_oidc_config_test.go @@ -226,6 +226,7 @@ func TestCommandSide_ChangeDefaultIDPOIDCConfig(t *testing.T) { ), ), }, + nil, ), ), secretCrypto: crypto.CreateMockEncryptionAlg(gomock.NewController(t)), diff --git a/internal/command/iam_member_test.go b/internal/command/iam_member_test.go index 5a11ea5299..ee9403e851 100644 --- a/internal/command/iam_member_test.go +++ b/internal/command/iam_member_test.go @@ -180,6 +180,7 @@ func TestCommandSide_AddIAMMember(t *testing.T) { []string{"IAM_OWNER"}..., )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("IAM", "user1")), ), ), @@ -230,6 +231,7 @@ func TestCommandSide_AddIAMMember(t *testing.T) { []string{"IAM_OWNER"}..., )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("IAM", "user1")), ), ), @@ -408,6 +410,7 @@ func TestCommandSide_ChangeIAMMember(t *testing.T) { []string{"IAM_OWNER", "IAM_OWNER_VIEWER"}..., )), }, + nil, ), ), zitadelRoles: []authz.RoleMapping{ @@ -528,6 +531,7 @@ func TestCommandSide_RemoveIAMMember(t *testing.T) { "user1", )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewRemoveMemberUniqueConstraint("IAM", "user1")), ), ), diff --git a/internal/command/iam_policy_label_test.go b/internal/command/iam_policy_label_test.go index 758f00176e..ce9d24ca00 100644 --- a/internal/command/iam_policy_label_test.go +++ b/internal/command/iam_policy_label_test.go @@ -95,6 +95,7 @@ func TestCommandSide_AddDefaultLabelPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -243,6 +244,7 @@ func TestCommandSide_ChangeDefaultLabelPolicy(t *testing.T) { newDefaultLabelPolicyChangedEvent(context.Background(), "primary-color-change", "secondary-color-change", false), ), }, + nil, ), ), }, diff --git a/internal/command/iam_policy_login_test.go b/internal/command/iam_policy_login_test.go index 6bc560c764..1e506a3d62 100644 --- a/internal/command/iam_policy_login_test.go +++ b/internal/command/iam_policy_login_test.go @@ -83,6 +83,7 @@ func TestCommandSide_AddDefaultLoginPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -223,6 +224,7 @@ func TestCommandSide_ChangeDefaultLoginPolicy(t *testing.T) { newDefaultLoginPolicyChangedEvent(context.Background(), false, false, false, false, domain.PasswordlessTypeNotAllowed), ), }, + nil, ), ), }, @@ -392,6 +394,7 @@ func TestCommandSide_AddIDPProviderDefaultLoginPolicy(t *testing.T) { "config1"), ), }, + nil, ), ), }, @@ -555,6 +558,7 @@ func TestCommandSide_RemoveIDPProviderDefaultLoginPolicy(t *testing.T) { "config1"), ), }, + nil, ), ), }, @@ -601,6 +605,7 @@ func TestCommandSide_RemoveIDPProviderDefaultLoginPolicy(t *testing.T) { "config1"), ), }, + nil, ), ), }, @@ -666,6 +671,7 @@ func TestCommandSide_RemoveIDPProviderDefaultLoginPolicy(t *testing.T) { &user.NewAggregate("user1", "org1").Aggregate, "config1", "externaluser1")), }, + nil, uniqueConstraintsFromEventConstraint(user.NewRemoveExternalIDPUniqueConstraint("config1", "externaluser1")), ), ), @@ -781,6 +787,7 @@ func TestCommandSide_AddSecondFactorDefaultLoginPolicy(t *testing.T) { domain.SecondFactorTypeOTP), ), }, + nil, ), ), }, @@ -913,6 +920,7 @@ func TestCommandSide_RemoveSecondFactorDefaultLoginPolicy(t *testing.T) { domain.SecondFactorTypeOTP), ), }, + nil, ), ), }, @@ -1016,6 +1024,7 @@ func TestCommandSide_AddMultiFactorDefaultLoginPolicy(t *testing.T) { domain.MultiFactorTypeU2FWithPIN), ), }, + nil, ), ), }, @@ -1148,6 +1157,7 @@ func TestCommandSide_RemoveMultiFactorDefaultLoginPolicy(t *testing.T) { domain.MultiFactorTypeU2FWithPIN), ), }, + nil, ), ), }, diff --git a/internal/command/iam_policy_mail_template_test.go b/internal/command/iam_policy_mail_template_test.go index 1f03ac795d..3576f3688e 100644 --- a/internal/command/iam_policy_mail_template_test.go +++ b/internal/command/iam_policy_mail_template_test.go @@ -86,6 +86,7 @@ func TestCommandSide_AddDefaultMailTemplatePolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -220,6 +221,7 @@ func TestCommandSide_ChangeDefaultMailTemplatePolicy(t *testing.T) { newDefaultMailTemplatePolicyChangedEvent(context.Background(), []byte("template-change")), ), }, + nil, ), ), }, diff --git a/internal/command/iam_policy_mail_text_test.go b/internal/command/iam_policy_mail_text_test.go index d63a1057f6..6f1a2eedc8 100644 --- a/internal/command/iam_policy_mail_text_test.go +++ b/internal/command/iam_policy_mail_text_test.go @@ -107,6 +107,7 @@ func TestCommandSide_AddDefaultMailTextPolicy(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(policy.NewAddMailTextUniqueConstraint("IAM", "mail-text-type", "de")), ), ), @@ -294,6 +295,7 @@ func TestCommandSide_ChangeDefaultMailTextPolicy(t *testing.T) { "button-text-change"), ), }, + nil, ), ), }, diff --git a/internal/command/iam_policy_org_iam_test.go b/internal/command/iam_policy_org_iam_test.go index 358a159b71..1551c5d176 100644 --- a/internal/command/iam_policy_org_iam_test.go +++ b/internal/command/iam_policy_org_iam_test.go @@ -71,6 +71,7 @@ func TestCommandSide_AddDefaultOrgIAMPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -190,6 +191,7 @@ func TestCommandSide_ChangeDefaultOrgIAMPolicy(t *testing.T) { newDefaultOrgIAMPolicyChangedEvent(context.Background(), false), ), }, + nil, ), ), }, diff --git a/internal/command/iam_policy_password_age_test.go b/internal/command/iam_policy_password_age_test.go index 672489afea..4dc30d9494 100644 --- a/internal/command/iam_policy_password_age_test.go +++ b/internal/command/iam_policy_password_age_test.go @@ -74,6 +74,7 @@ func TestCommandSide_AddDefaultPasswordAgePolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -199,6 +200,7 @@ func TestCommandSide_ChangeDefaultPasswordAgePolicy(t *testing.T) { newDefaultPasswordAgePolicyChangedEvent(context.Background(), 125, 5), ), }, + nil, ), ), }, diff --git a/internal/command/iam_policy_password_complexity_test.go b/internal/command/iam_policy_password_complexity_test.go index 627e90e14d..a93d77b99a 100644 --- a/internal/command/iam_policy_password_complexity_test.go +++ b/internal/command/iam_policy_password_complexity_test.go @@ -98,6 +98,7 @@ func TestCommandSide_AddDefaultPasswordComplexityPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -256,6 +257,7 @@ func TestCommandSide_ChangeDefaultPasswordComplexityPolicy(t *testing.T) { newDefaultPasswordComplexityPolicyChangedEvent(context.Background(), 10, false, false, false, false), ), }, + nil, ), ), }, diff --git a/internal/command/iam_policy_password_lockout_test.go b/internal/command/iam_policy_password_lockout_test.go index 97fe84e3e0..eece88d21c 100644 --- a/internal/command/iam_policy_password_lockout_test.go +++ b/internal/command/iam_policy_password_lockout_test.go @@ -74,6 +74,7 @@ func TestCommandSide_AddDefaultPasswordLockoutPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -199,6 +200,7 @@ func TestCommandSide_ChangeDefaultPasswordLockoutPolicy(t *testing.T) { newDefaultPasswordLockoutPolicyChangedEvent(context.Background(), 20, false), ), }, + nil, ), ), }, diff --git a/internal/command/main_test.go b/internal/command/main_test.go index 050530c968..b391dddd93 100644 --- a/internal/command/main_test.go +++ b/internal/command/main_test.go @@ -103,15 +103,15 @@ func (repo *testRepo) LatestSequence(ctx context.Context, queryFactory *reposito return repo.sequence, nil } -func expectPush(events []*repository.Event, uniqueConstraints ...*repository.UniqueConstraint) expect { +func expectPush(events []*repository.Event, assets []*repository.Asset, uniqueConstraints ...*repository.UniqueConstraint) expect { return func(m *mock.MockRepository) { - m.ExpectPush(events, uniqueConstraints...) + m.ExpectPush(events, assets, uniqueConstraints...) } } -func expectPushFailed(err error, events []*repository.Event, uniqueConstraints ...*repository.UniqueConstraint) expect { +func expectPushFailed(err error, events []*repository.Event, assets []*repository.Asset, uniqueConstraints ...*repository.UniqueConstraint) expect { return func(m *mock.MockRepository) { - m.ExpectPushFailed(err, events, uniqueConstraints...) + m.ExpectPushFailed(err, events, assets, uniqueConstraints...) } } diff --git a/internal/command/org_domain_test.go b/internal/command/org_domain_test.go index 9dd4094d40..7524f8a20a 100644 --- a/internal/command/org_domain_test.go +++ b/internal/command/org_domain_test.go @@ -108,6 +108,7 @@ func TestCommandSide_AddOrgDomain(t *testing.T) { "domain.ch", )), }, + nil, ), ), }, @@ -322,6 +323,7 @@ func TestCommandSide_GenerateOrgDomainValidation(t *testing.T) { }, )), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -374,6 +376,7 @@ func TestCommandSide_GenerateOrgDomainValidation(t *testing.T) { }, )), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -618,6 +621,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) { "domain.ch", )), }, + nil, ), ), alg: crypto.CreateMockEncryptionAlg(gomock.NewController(t)), @@ -676,6 +680,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) { "domain.ch", )), }, + nil, uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("domain.ch")), ), ), @@ -738,6 +743,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) { "domain.ch", )), }, + nil, uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("domain.ch")), ), ), @@ -827,6 +833,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) { false, )), }, + nil, uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("domain.ch")), uniqueConstraintsFromEventConstraint(user.NewRemoveUsernameUniqueConstraint("username@domain.ch", "org2", false)), uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("tempid@temporary.zitadel.ch", "org2", false)), @@ -1027,6 +1034,7 @@ func TestCommandSide_SetPrimaryDomain(t *testing.T) { "domain.ch", )), }, + nil, ), ), }, @@ -1220,6 +1228,7 @@ func TestCommandSide_RemoveOrgDomain(t *testing.T) { "domain.ch", false, )), }, + nil, ), ), }, @@ -1270,6 +1279,7 @@ func TestCommandSide_RemoveOrgDomain(t *testing.T) { "domain.ch", true, )), }, + nil, uniqueConstraintsFromEventConstraint(org.NewRemoveOrgDomainUniqueConstraint("domain.ch")), ), ), diff --git a/internal/command/org_features_test.go b/internal/command/org_features_test.go index eab0cb72a8..8f9559722e 100644 --- a/internal/command/org_features_test.go +++ b/internal/command/org_features_test.go @@ -175,6 +175,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) { newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour), ), }, + nil, ), ), iamDomain: "iam-domain", @@ -308,6 +309,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) { newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour), ), }, + nil, uniqueConstraintsFromEventConstraint(org.NewRemoveOrgDomainUniqueConstraint("test1")), ), ), @@ -452,6 +454,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) { newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour), ), }, + nil, uniqueConstraintsFromEventConstraint(org.NewRemoveOrgDomainUniqueConstraint("test1")), ), ), @@ -606,6 +609,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) { newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour), ), }, + nil, uniqueConstraintsFromEventConstraint(org.NewRemoveOrgDomainUniqueConstraint("test1")), ), ), @@ -802,6 +806,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) { newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour), ), }, + nil, ), ), iamDomain: "iam-domain", @@ -984,6 +989,7 @@ func TestCommandSide_RemoveOrgFeatures(t *testing.T) { org.NewFeaturesRemovedEvent(context.Background(), &org.NewAggregate("org1", "org1").Aggregate), ), }, + nil, ), ), iamDomain: "iam-domain", diff --git a/internal/command/org_idp_config_test.go b/internal/command/org_idp_config_test.go index 8ffbbad682..652e7605d8 100644 --- a/internal/command/org_idp_config_test.go +++ b/internal/command/org_idp_config_test.go @@ -116,6 +116,7 @@ func TestCommandSide_AddIDPConfig(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(idpconfig.NewAddIDPConfigNameUniqueConstraint("name1", "org1")), ), ), @@ -282,6 +283,7 @@ func TestCommandSide_ChangeIDPConfig(t *testing.T) { newIDPConfigChangedEvent(context.Background(), "org1", "config1", "name1", "name2", domain.IDPConfigStylingTypeUnspecified), ), }, + nil, uniqueConstraintsFromEventConstraint(idpconfig.NewRemoveIDPConfigNameUniqueConstraint("name1", "org1")), uniqueConstraintsFromEventConstraint(idpconfig.NewAddIDPConfigNameUniqueConstraint("name2", "org1")), ), diff --git a/internal/command/org_idp_oidc_config_test.go b/internal/command/org_idp_oidc_config_test.go index 30a94380e6..1d4970bd26 100644 --- a/internal/command/org_idp_oidc_config_test.go +++ b/internal/command/org_idp_oidc_config_test.go @@ -249,6 +249,7 @@ func TestCommandSide_ChangeIDPOIDCConfig(t *testing.T) { ), ), }, + nil, ), ), secretCrypto: crypto.CreateMockEncryptionAlg(gomock.NewController(t)), diff --git a/internal/command/org_member_test.go b/internal/command/org_member_test.go index 689608ebf5..8a2c1036f7 100644 --- a/internal/command/org_member_test.go +++ b/internal/command/org_member_test.go @@ -196,6 +196,7 @@ func TestCommandSide_AddOrgMember(t *testing.T) { []string{"ORG_OWNER"}..., )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org1", "user1")), ), ), @@ -249,6 +250,7 @@ func TestCommandSide_AddOrgMember(t *testing.T) { []string{"ORG_OWNER"}..., )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org1", "user1")), ), ), @@ -443,6 +445,7 @@ func TestCommandSide_ChangeOrgMember(t *testing.T) { []string{"ORG_OWNER", "ORG_OWNER_VIEWER"}..., )), }, + nil, ), ), zitadelRoles: []authz.RoleMapping{ @@ -589,6 +592,7 @@ func TestCommandSide_RemoveOrgMember(t *testing.T) { "user1", )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewRemoveMemberUniqueConstraint("project1", "user1")), ), ), diff --git a/internal/command/org_policy_label_test.go b/internal/command/org_policy_label_test.go index 149ce1f7fe..c6984ee540 100644 --- a/internal/command/org_policy_label_test.go +++ b/internal/command/org_policy_label_test.go @@ -118,6 +118,7 @@ func TestCommandSide_AddLabelPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -289,6 +290,7 @@ func TestCommandSide_ChangeLabelPolicy(t *testing.T) { newLabelPolicyChangedEvent(context.Background(), "org1", "primary-color-change", "secondary-color-change", false), ), }, + nil, ), ), }, @@ -402,6 +404,7 @@ func TestCommandSide_RemoveLabelPolicy(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate), ), }, + nil, ), ), }, diff --git a/internal/command/org_policy_login_test.go b/internal/command/org_policy_login_test.go index e78501ee9a..a3dca7570c 100644 --- a/internal/command/org_policy_login_test.go +++ b/internal/command/org_policy_login_test.go @@ -158,6 +158,7 @@ func TestCommandSide_AddLoginPolicy(t *testing.T) { ), ), }, + nil, ), ), tokenVerifier: GetMockVerifier(t, domain.FeatureLoginPolicyUsernameLogin), @@ -401,6 +402,7 @@ func TestCommandSide_ChangeLoginPolicy(t *testing.T) { newLoginPolicyChangedEvent(context.Background(), "org1", false, false, false, false, domain.PasswordlessTypeNotAllowed), ), }, + nil, ), ), tokenVerifier: GetMockVerifier(t, domain.FeatureLoginPolicyUsernameLogin), @@ -523,6 +525,7 @@ func TestCommandSide_RemoveLoginPolicy(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate), ), }, + nil, ), ), }, @@ -707,6 +710,7 @@ func TestCommandSide_AddIDPProviderLoginPolicy(t *testing.T) { domain.IdentityProviderTypeOrg), ), }, + nil, ), ), }, @@ -901,6 +905,7 @@ func TestCommandSide_RemoveIDPProviderLoginPolicy(t *testing.T) { "config1"), ), }, + nil, ), ), }, @@ -951,6 +956,7 @@ func TestCommandSide_RemoveIDPProviderLoginPolicy(t *testing.T) { "config1"), ), }, + nil, ), ), }, @@ -1020,6 +1026,7 @@ func TestCommandSide_RemoveIDPProviderLoginPolicy(t *testing.T) { &user.NewAggregate("user1", "org1").Aggregate, "config1", "externaluser1")), }, + nil, uniqueConstraintsFromEventConstraint(user.NewRemoveExternalIDPUniqueConstraint("config1", "externaluser1")), ), ), @@ -1153,6 +1160,7 @@ func TestCommandSide_AddSecondFactorLoginPolicy(t *testing.T) { domain.SecondFactorTypeOTP), ), }, + nil, ), ), }, @@ -1302,6 +1310,7 @@ func TestCommandSide_RemoveSecondFactoroginPolicy(t *testing.T) { domain.SecondFactorTypeOTP), ), }, + nil, ), ), }, @@ -1420,6 +1429,7 @@ func TestCommandSide_AddMultiFactorLoginPolicy(t *testing.T) { domain.MultiFactorTypeU2FWithPIN), ), }, + nil, ), ), }, @@ -1569,6 +1579,7 @@ func TestCommandSide_RemoveMultiFactorLoginPolicy(t *testing.T) { domain.MultiFactorTypeU2FWithPIN), ), }, + nil, ), ), }, diff --git a/internal/command/org_policy_mail_template_test.go b/internal/command/org_policy_mail_template_test.go index cd5b158aa3..bdd900784b 100644 --- a/internal/command/org_policy_mail_template_test.go +++ b/internal/command/org_policy_mail_template_test.go @@ -92,6 +92,7 @@ func TestCommandSide_AddMailTemplate(t *testing.T) { ), ), }, + nil, ), ), }, @@ -232,6 +233,7 @@ func TestCommandSide_ChangeMailTemplate(t *testing.T) { newMailTemplateChangedEvent(context.Background(), "org1", "template2"), ), }, + nil, ), ), }, @@ -340,6 +342,7 @@ func TestCommandSide_RemoveMailTemplate(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate), ), }, + nil, ), ), }, diff --git a/internal/command/org_policy_mail_text_test.go b/internal/command/org_policy_mail_text_test.go index b8ddfcbcc8..1bcdc8f11d 100644 --- a/internal/command/org_policy_mail_text_test.go +++ b/internal/command/org_policy_mail_text_test.go @@ -160,6 +160,7 @@ func TestCommandSide_AddMailText(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(policy.NewAddMailTextUniqueConstraint("org1", "mail-text-type", "de")), ), ), @@ -376,6 +377,7 @@ func TestCommandSide_ChangeMailText(t *testing.T) { "button-text-change"), ), }, + nil, ), ), }, @@ -512,6 +514,7 @@ func TestCommandSide_RemoveMailText(t *testing.T) { "de"), ), }, + nil, uniqueConstraintsFromEventConstraint(policy.NewRemoveMailTextUniqueConstraint("org1", "mail-text-type", "de")), ), ), diff --git a/internal/command/org_policy_org_iam_test.go b/internal/command/org_policy_org_iam_test.go index 9d3a7aa67e..1bedec9cd3 100644 --- a/internal/command/org_policy_org_iam_test.go +++ b/internal/command/org_policy_org_iam_test.go @@ -92,6 +92,7 @@ func TestCommandSide_AddOrgIAMPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -232,6 +233,7 @@ func TestCommandSide_ChangeOrgIAMPolicy(t *testing.T) { newOrgIAMPolicyChangedEvent(context.Background(), "org1", false), ), }, + nil, ), ), }, @@ -340,6 +342,7 @@ func TestCommandSide_RemoveOrgIAMPolicy(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate), ), }, + nil, ), ), }, diff --git a/internal/command/org_policy_password_age_test.go b/internal/command/org_policy_password_age_test.go index 81eccaee51..152d5b746b 100644 --- a/internal/command/org_policy_password_age_test.go +++ b/internal/command/org_policy_password_age_test.go @@ -96,6 +96,7 @@ func TestCommandSide_AddPasswordAgePolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -243,6 +244,7 @@ func TestCommandSide_ChangePasswordAgePolicy(t *testing.T) { newPasswordAgePolicyChangedEvent(context.Background(), "org1", 150, 5), ), }, + nil, ), ), }, @@ -354,6 +356,7 @@ func TestCommandSide_RemovePasswordAgePolicy(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate), ), }, + nil, ), ), }, diff --git a/internal/command/org_policy_password_complexity_test.go b/internal/command/org_policy_password_complexity_test.go index 5438ed3622..4d72054870 100644 --- a/internal/command/org_policy_password_complexity_test.go +++ b/internal/command/org_policy_password_complexity_test.go @@ -102,6 +102,7 @@ func TestCommandSide_AddPasswordComplexityPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -264,6 +265,7 @@ func TestCommandSide_ChangePasswordComplexityPolicy(t *testing.T) { newPasswordComplexityPolicyChangedEvent(context.Background(), "org1", 10, false, false, false, false), ), }, + nil, ), ), }, @@ -381,6 +383,7 @@ func TestCommandSide_RemovePasswordComplexityPolicy(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate), ), }, + nil, ), ), }, diff --git a/internal/command/org_policy_password_lockout_test.go b/internal/command/org_policy_password_lockout_test.go index 5e611fcfb3..941bac4a8c 100644 --- a/internal/command/org_policy_password_lockout_test.go +++ b/internal/command/org_policy_password_lockout_test.go @@ -96,6 +96,7 @@ func TestCommandSide_AddPasswordLockoutPolicy(t *testing.T) { ), ), }, + nil, ), ), }, @@ -243,6 +244,7 @@ func TestCommandSide_ChangePasswordLockoutPolicy(t *testing.T) { newPasswordLockoutPolicyChangedEvent(context.Background(), "org1", 5, false), ), }, + nil, ), ), }, @@ -354,6 +356,7 @@ func TestCommandSide_RemovePasswordLockoutPolicy(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate), ), }, + nil, ), ), }, diff --git a/internal/command/org_test.go b/internal/command/org_test.go index c8d06e134f..31b372d4a5 100644 --- a/internal/command/org_test.go +++ b/internal/command/org_test.go @@ -148,6 +148,7 @@ func TestCommandSide_AddOrg(t *testing.T) { &org.NewAggregate("org2", "org2").Aggregate, "user1", domain.RoleOrgOwner)), }, + nil, uniqueConstraintsFromEventConstraint(org.NewAddOrgNameUniqueConstraint("Org")), uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("org.iam-domain")), uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org2", "user1")), @@ -217,6 +218,7 @@ func TestCommandSide_AddOrg(t *testing.T) { &org.NewAggregate("org2", "org2").Aggregate, "user1", domain.RoleOrgOwner)), }, + nil, uniqueConstraintsFromEventConstraint(org.NewAddOrgNameUniqueConstraint("Org")), uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("org.iam-domain")), uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org2", "user1")), @@ -286,6 +288,7 @@ func TestCommandSide_AddOrg(t *testing.T) { domain.RoleOrgOwner, )), }, + nil, uniqueConstraintsFromEventConstraint(org.NewAddOrgNameUniqueConstraint("Org")), uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("org.iam-domain")), uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org2", "user1")), @@ -420,6 +423,7 @@ func TestCommandSide_DeactivateOrg(t *testing.T) { eventFromEventPusher(org.NewOrgDeactivatedEvent(context.Background(), &org.NewAggregate("org1", "org1").Aggregate)), }, + nil, ), ), }, @@ -449,6 +453,7 @@ func TestCommandSide_DeactivateOrg(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate, )), }, + nil, ), ), }, @@ -557,6 +562,7 @@ func TestCommandSide_ReactivateOrg(t *testing.T) { &org.NewAggregate("org1", "org1").Aggregate, )), }, + nil, ), ), }, @@ -589,6 +595,7 @@ func TestCommandSide_ReactivateOrg(t *testing.T) { eventFromEventPusher(org.NewOrgReactivatedEvent(context.Background(), &org.NewAggregate("org1", "org1").Aggregate)), }, + nil, ), ), }, diff --git a/internal/command/project_application_api_test.go b/internal/command/project_application_api_test.go index a438b4f285..3f359e5502 100644 --- a/internal/command/project_application_api_test.go +++ b/internal/command/project_application_api_test.go @@ -139,6 +139,7 @@ func TestCommandSide_AddAPIApplication(t *testing.T) { domain.APIAuthMethodTypeBasic), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddApplicationUniqueConstraint("app", "project1")), ), ), @@ -201,6 +202,7 @@ func TestCommandSide_AddAPIApplication(t *testing.T) { domain.APIAuthMethodTypePrivateKeyJWT), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddApplicationUniqueConstraint("app", "project1")), ), ), @@ -418,6 +420,7 @@ func TestCommandSide_ChangeAPIApplication(t *testing.T) { domain.APIAuthMethodTypePrivateKeyJWT), ), }, + nil, ), ), }, @@ -580,6 +583,7 @@ func TestCommandSide_ChangeAPIApplicationSecret(t *testing.T) { }), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), diff --git a/internal/command/project_application_oidc_test.go b/internal/command/project_application_oidc_test.go index f4079603b6..eecfb20d36 100644 --- a/internal/command/project_application_oidc_test.go +++ b/internal/command/project_application_oidc_test.go @@ -154,6 +154,7 @@ func TestCommandSide_AddOIDCApplication(t *testing.T) { time.Second*1), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddApplicationUniqueConstraint("app", "project1")), ), ), @@ -463,6 +464,7 @@ func TestCommandSide_ChangeOIDCApplication(t *testing.T) { "org1"), ), }, + nil, ), ), }, @@ -662,6 +664,7 @@ func TestCommandSide_ChangeOIDCApplicationSecret(t *testing.T) { }), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), diff --git a/internal/command/project_application_test.go b/internal/command/project_application_test.go index 88ef37eb45..883c3ff0fe 100644 --- a/internal/command/project_application_test.go +++ b/internal/command/project_application_test.go @@ -159,6 +159,7 @@ func TestCommandSide_ChangeApplication(t *testing.T) { "app changed", )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveApplicationUniqueConstraint("app", "project1")), uniqueConstraintsFromEventConstraint(project.NewAddApplicationUniqueConstraint("app changed", "project1")), ), @@ -318,6 +319,7 @@ func TestCommandSide_DeactivateApplication(t *testing.T) { "app1", )), }, + nil, ), ), }, @@ -472,6 +474,7 @@ func TestCommandSide_ReactivateApplication(t *testing.T) { "app1", )), }, + nil, ), ), }, @@ -599,6 +602,7 @@ func TestCommandSide_RemoveApplication(t *testing.T) { "app", )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveApplicationUniqueConstraint("app", "project1")), ), ), diff --git a/internal/command/project_grant_member_test.go b/internal/command/project_grant_member_test.go index 79c1a638c3..7e7025fb73 100644 --- a/internal/command/project_grant_member_test.go +++ b/internal/command/project_grant_member_test.go @@ -186,6 +186,7 @@ func TestCommandSide_AddProjectGrantMember(t *testing.T) { []string{"PROJECT_GRANT_OWNER"}..., )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectGrantMemberUniqueConstraint("project1", "user1", "projectgrant1")), ), ), @@ -241,6 +242,7 @@ func TestCommandSide_AddProjectGrantMember(t *testing.T) { []string{"PROJECT_GRANT_OWNER"}..., )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectGrantMemberUniqueConstraint("project1", "user1", "projectgrant1")), ), ), @@ -442,6 +444,7 @@ func TestCommandSide_ChangeProjectGrantMember(t *testing.T) { []string{"PROJECT_GRANT_OWNER", "PROJECT_GRANT_VIEWER"}..., )), }, + nil, ), ), zitadelRoles: []authz.RoleMapping{ @@ -609,6 +612,7 @@ func TestCommandSide_RemoveProjectGrantMember(t *testing.T) { "projectgrant1", )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectGrantMemberUniqueConstraint("project1", "user1", "projectgrant1")), ), ), diff --git a/internal/command/project_grant_test.go b/internal/command/project_grant_test.go index 4274622b52..ebdd11714e 100644 --- a/internal/command/project_grant_test.go +++ b/internal/command/project_grant_test.go @@ -179,6 +179,7 @@ func TestCommandSide_AddProjectGrant(t *testing.T) { []string{"key1"}, )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectGrantUniqueConstraint("grantedorg1", "project1")), ), ), @@ -511,6 +512,7 @@ func TestCommandSide_ChangeProjectGrant(t *testing.T) { []string{"key1", "key2"}, )), }, + nil, ), ), }, @@ -591,6 +593,7 @@ func TestCommandSide_ChangeProjectGrant(t *testing.T) { []string{"key1"}, )), }, + nil, ), ), }, @@ -685,6 +688,7 @@ func TestCommandSide_ChangeProjectGrant(t *testing.T) { []string{"key1"}, )), }, + nil, ), ), }, @@ -895,6 +899,7 @@ func TestCommandSide_DeactivateProjectGrant(t *testing.T) { "projectgrant1", )), }, + nil, ), ), }, @@ -1091,6 +1096,7 @@ func TestCommandSide_ReactivateProjectGrant(t *testing.T) { "projectgrant1", )), }, + nil, ), ), }, @@ -1252,6 +1258,7 @@ func TestCommandSide_RemoveProjectGrant(t *testing.T) { "grantedorg1", )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectGrantUniqueConstraint("grantedorg1", "project1")), ), ), @@ -1298,6 +1305,7 @@ func TestCommandSide_RemoveProjectGrant(t *testing.T) { "grantedorg1", )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectGrantUniqueConstraint("grantedorg1", "project1")), ), ), @@ -1357,6 +1365,7 @@ func TestCommandSide_RemoveProjectGrant(t *testing.T) { "projectgrant1", )), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectGrantUniqueConstraint("grantedorg1", "project1")), uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "projectgrant1")), ), diff --git a/internal/command/project_member_test.go b/internal/command/project_member_test.go index 7921b9053e..3574daab76 100644 --- a/internal/command/project_member_test.go +++ b/internal/command/project_member_test.go @@ -187,6 +187,7 @@ func TestCommandSide_AddProjectMember(t *testing.T) { []string{"PROJECT_OWNER"}..., )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")), ), ), @@ -241,6 +242,7 @@ func TestCommandSide_AddProjectMember(t *testing.T) { []string{"PROJECT_OWNER"}..., )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")), ), ), @@ -441,6 +443,7 @@ func TestCommandSide_ChangeProjectMember(t *testing.T) { []string{"PROJECT_OWNER", "PROJECT_VIEWER"}..., )), }, + nil, ), ), zitadelRoles: []authz.RoleMapping{ @@ -588,6 +591,7 @@ func TestCommandSide_RemoveProjectMember(t *testing.T) { "user1", )), }, + nil, uniqueConstraintsFromEventConstraint(member.NewRemoveMemberUniqueConstraint("project1", "user1")), ), ), diff --git a/internal/command/project_role_test.go b/internal/command/project_role_test.go index a4bebdd1ea..50886771b1 100644 --- a/internal/command/project_role_test.go +++ b/internal/command/project_role_test.go @@ -119,6 +119,7 @@ func TestCommandSide_AddProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key1", "project1")), ), ), @@ -163,6 +164,7 @@ func TestCommandSide_AddProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key1", "project1")), ), ), @@ -332,6 +334,7 @@ func TestCommandSide_BulkAddProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key1", "project1")), uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key2", "project1")), ), @@ -390,6 +393,7 @@ func TestCommandSide_BulkAddProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key1", "project1")), uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key2", "project1")), ), @@ -629,6 +633,7 @@ func TestCommandSide_ChangeProjectRole(t *testing.T) { newRoleChangedEvent(context.Background(), "project1", "org1", "key1", "keychanged", "groupchanged"), ), }, + nil, ), ), }, @@ -806,6 +811,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")), ), ), @@ -847,6 +853,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")), ), ), @@ -905,6 +912,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")), ), ), @@ -947,6 +955,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")), ), ), @@ -1003,6 +1012,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")), ), ), diff --git a/internal/command/project_test.go b/internal/command/project_test.go index bfb1afeb55..e689d2fd61 100644 --- a/internal/command/project_test.go +++ b/internal/command/project_test.go @@ -82,6 +82,7 @@ func TestCommandSide_AddProject(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectNameUniqueConstraint("project", "org1")), uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")), ), @@ -129,6 +130,7 @@ func TestCommandSide_AddProject(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectNameUniqueConstraint("project", "globalorg")), uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")), ), @@ -182,6 +184,7 @@ func TestCommandSide_AddProject(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewAddProjectNameUniqueConstraint("project", "org1")), uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")), ), @@ -391,6 +394,7 @@ func TestCommandSide_ChangeProject(t *testing.T) { true), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectNameUniqueConstraint("project", "org1")), uniqueConstraintsFromEventConstraint(project.NewAddProjectNameUniqueConstraint("project-new", "org1")), ), @@ -444,6 +448,7 @@ func TestCommandSide_ChangeProject(t *testing.T) { true), ), }, + nil, ), ), }, @@ -633,6 +638,7 @@ func TestCommandSide_DeactivateProject(t *testing.T) { &project.NewAggregate("project1", "org1").Aggregate), ), }, + nil, ), ), }, @@ -809,6 +815,7 @@ func TestCommandSide_ReactivateProject(t *testing.T) { &project.NewAggregate("project1", "org1").Aggregate), ), }, + nil, ), ), }, @@ -959,6 +966,7 @@ func TestCommandSide_RemoveProject(t *testing.T) { "project"), ), }, + nil, uniqueConstraintsFromEventConstraint(project.NewRemoveProjectNameUniqueConstraint("project", "org1")), ), ), diff --git a/internal/command/user_grant_test.go b/internal/command/user_grant_test.go index 0ca74a2ca3..17fb902b17 100644 --- a/internal/command/user_grant_test.go +++ b/internal/command/user_grant_test.go @@ -353,6 +353,7 @@ func TestCommandSide_AddUserGrant(t *testing.T) { []string{"rolekey1"}, )), }, + nil, uniqueConstraintsFromEventConstraint(usergrant.NewAddUserGrantUniqueConstraint("org1", "user1", "project1", "")), ), ), @@ -433,6 +434,7 @@ func TestCommandSide_AddUserGrant(t *testing.T) { []string{"rolekey1"}, )), }, + nil, uniqueConstraintsFromEventConstraint(usergrant.NewAddUserGrantUniqueConstraint("org1", "user1", "project1", "projectgrant1")), ), ), @@ -971,6 +973,7 @@ func TestCommandSide_ChangeUserGrant(t *testing.T) { []string{"rolekey1", "rolekey2"}, )), }, + nil, ), ), }, @@ -1066,6 +1069,7 @@ func TestCommandSide_ChangeUserGrant(t *testing.T) { []string{"rolekey1", "rolekey2"}, )), }, + nil, ), ), }, @@ -1290,6 +1294,7 @@ func TestCommandSide_DeactivateUserGrant(t *testing.T) { ), ), }, + nil, ), ), }, @@ -1502,6 +1507,7 @@ func TestCommandSide_ReactivateUserGrant(t *testing.T) { ), ), }, + nil, ), ), }, @@ -1673,6 +1679,7 @@ func TestCommandSide_RemoveUserGrant(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "")), ), ), @@ -1713,6 +1720,7 @@ func TestCommandSide_RemoveUserGrant(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "projectgrant1")), ), ), @@ -1898,6 +1906,7 @@ func TestCommandSide_BulkRemoveUserGrant(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "")), uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user2", "project2", "")), ), @@ -1952,6 +1961,7 @@ func TestCommandSide_BulkRemoveUserGrant(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "projectgrant1")), uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user2", "project2", "projectgrant2")), ), diff --git a/internal/command/user_human_adress_test.go b/internal/command/user_human_adress_test.go index 5997f5eb09..a4a3db5a8b 100644 --- a/internal/command/user_human_adress_test.go +++ b/internal/command/user_human_adress_test.go @@ -143,6 +143,7 @@ func TestCommandSide_ChangeHumanAddress(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/command/user_human_email_test.go b/internal/command/user_human_email_test.go index eadb20d040..57953c2fcb 100644 --- a/internal/command/user_human_email_test.go +++ b/internal/command/user_human_email_test.go @@ -194,6 +194,7 @@ func TestCommandSide_ChangeHumanEmail(t *testing.T) { ), ), }, + nil, ), ), }, @@ -261,6 +262,7 @@ func TestCommandSide_ChangeHumanEmail(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -451,6 +453,7 @@ func TestCommandSide_VerifyHumanEmail(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -506,6 +509,7 @@ func TestCommandSide_VerifyHumanEmail(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -717,6 +721,7 @@ func TestCommandSide_CreateVerificationCodeHumanEmail(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -843,6 +848,7 @@ func TestCommandSide_EmailVerificationCodeSent(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/command/user_human_externalidp_test.go b/internal/command/user_human_externalidp_test.go index 9438ed45cb..4b73636950 100644 --- a/internal/command/user_human_externalidp_test.go +++ b/internal/command/user_human_externalidp_test.go @@ -178,6 +178,7 @@ func TestCommandSide_BulkAddExternalIDPs(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddExternalIDPUniqueConstraint("config1", "externaluser1")), ), ), @@ -227,6 +228,7 @@ func TestCommandSide_BulkAddExternalIDPs(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddExternalIDPUniqueConstraint("config1", "externaluser1")), ), ), @@ -407,6 +409,7 @@ func TestCommandSide_RemoveExternalIDP(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewRemoveExternalIDPUniqueConstraint("config1", "externaluser1")), ), ), @@ -549,6 +552,7 @@ func TestCommandSide_ExternalLoginCheck(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/command/user_human_init_test.go b/internal/command/user_human_init_test.go index f0089fbf5a..1cb12b94a8 100644 --- a/internal/command/user_human_init_test.go +++ b/internal/command/user_human_init_test.go @@ -148,6 +148,7 @@ func TestCommandSide_ResendInitialMail(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -206,6 +207,7 @@ func TestCommandSide_ResendInitialMail(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -267,6 +269,7 @@ func TestCommandSide_ResendInitialMail(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -451,6 +454,7 @@ func TestCommandSide_VerifyInitCode(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -511,6 +515,7 @@ func TestCommandSide_VerifyInitCode(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -594,6 +599,7 @@ func TestCommandSide_VerifyInitCode(t *testing.T) { false, "")), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -710,6 +716,7 @@ func TestCommandSide_InitCodeSent(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/command/user_human_otp_test.go b/internal/command/user_human_otp_test.go index a92094bb23..c66461a54e 100644 --- a/internal/command/user_human_otp_test.go +++ b/internal/command/user_human_otp_test.go @@ -304,6 +304,7 @@ func TestCommandSide_RemoveHumanOTP(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/command/user_human_password_test.go b/internal/command/user_human_password_test.go index 1526b626bb..d64ecbb84d 100644 --- a/internal/command/user_human_password_test.go +++ b/internal/command/user_human_password_test.go @@ -125,6 +125,7 @@ func TestCommandSide_SetOneTimePassword(t *testing.T) { ), ), }, + nil, ), ), userPasswordAlg: crypto.CreateMockHashAlg(gomock.NewController(t)), @@ -384,6 +385,7 @@ func TestCommandSide_SetPassword(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -665,6 +667,7 @@ func TestCommandSide_ChangePassword(t *testing.T) { ), ), }, + nil, ), ), userPasswordAlg: crypto.CreateMockHashAlg(gomock.NewController(t)), @@ -850,6 +853,7 @@ func TestCommandSide_RequestSetPassword(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -971,6 +975,7 @@ func TestCommandSide_PasswordCodeSent(t *testing.T) { ), ), }, + nil, ), ), }, @@ -1152,6 +1157,7 @@ func TestCommandSide_CheckPassword(t *testing.T) { ), ), }, + nil, ), ), userPasswordAlg: crypto.CreateMockHashAlg(gomock.NewController(t)), @@ -1219,6 +1225,7 @@ func TestCommandSide_CheckPassword(t *testing.T) { ), ), }, + nil, ), ), userPasswordAlg: crypto.CreateMockHashAlg(gomock.NewController(t)), diff --git a/internal/command/user_human_phone_test.go b/internal/command/user_human_phone_test.go index 8b8e5a519c..f950ee6ca0 100644 --- a/internal/command/user_human_phone_test.go +++ b/internal/command/user_human_phone_test.go @@ -163,6 +163,7 @@ func TestCommandSide_ChangeHumanPhone(t *testing.T) { ), ), }, + nil, ), ), }, @@ -230,6 +231,7 @@ func TestCommandSide_ChangeHumanPhone(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -426,6 +428,7 @@ func TestCommandSide_VerifyHumanPhone(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -487,6 +490,7 @@ func TestCommandSide_VerifyHumanPhone(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -661,6 +665,7 @@ func TestCommandSide_CreateVerificationCodeHumanPhone(t *testing.T) { ), ), }, + nil, ), ), secretGenerator: GetMockSecretGenerator(t), @@ -782,6 +787,7 @@ func TestCommandSide_PhoneVerificationCodeSent(t *testing.T) { ), ), }, + nil, ), ), }, @@ -927,6 +933,7 @@ func TestCommandSide_RemoveHumanPhone(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/command/user_human_profile_test.go b/internal/command/user_human_profile_test.go index 6542d00c31..1be3960f4e 100644 --- a/internal/command/user_human_profile_test.go +++ b/internal/command/user_human_profile_test.go @@ -138,6 +138,7 @@ func TestCommandSide_ChangeHumanProfile(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/command/user_human_test.go b/internal/command/user_human_test.go index 0e7d1f6d41..b81e8eade5 100644 --- a/internal/command/user_human_test.go +++ b/internal/command/user_human_test.go @@ -225,6 +225,7 @@ func TestCommandSide_AddHuman(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -308,6 +309,7 @@ func TestCommandSide_AddHuman(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -387,6 +389,7 @@ func TestCommandSide_AddHuman(t *testing.T) { &user.NewAggregate("user1", "org1").Aggregate), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -486,6 +489,7 @@ func TestCommandSide_AddHuman(t *testing.T) { }, time.Hour*1)), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -579,6 +583,7 @@ func TestCommandSide_AddHuman(t *testing.T) { &user.NewAggregate("user1", "org1").Aggregate), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -843,6 +848,7 @@ func TestCommandSide_ImportHuman(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -923,6 +929,7 @@ func TestCommandSide_ImportHuman(t *testing.T) { &user.NewAggregate("user1", "org1").Aggregate), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -1023,6 +1030,7 @@ func TestCommandSide_ImportHuman(t *testing.T) { }, time.Hour*1)), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -1121,6 +1129,7 @@ func TestCommandSide_ImportHuman(t *testing.T) { &user.NewAggregate("user1", "org1").Aggregate), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -1381,6 +1390,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -1460,6 +1470,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) { &user.NewAggregate("user1", "org1").Aggregate), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -1559,6 +1570,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) { }, time.Hour*1)), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -1656,6 +1668,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) { &user.NewAggregate("user1", "org1").Aggregate), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -1814,6 +1827,7 @@ func TestCommandSide_HumanMFASkip(t *testing.T) { ), ), }, + nil, ), ), }, @@ -1943,6 +1957,7 @@ func TestCommandSide_HumanSignOut(t *testing.T) { ), ), }, + nil, ), ), }, @@ -2009,6 +2024,7 @@ func TestCommandSide_HumanSignOut(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/command/user_machine_test.go b/internal/command/user_machine_test.go index 2e9e0a83cd..e31cf36b5f 100644 --- a/internal/command/user_machine_test.go +++ b/internal/command/user_machine_test.go @@ -128,6 +128,7 @@ func TestCommandSide_AddMachine(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -291,6 +292,7 @@ func TestCommandSide_ChangeMachine(t *testing.T) { newMachineChangedEvent(context.Background(), "user1", "org1", "name1", "description1"), ), }, + nil, ), ), }, diff --git a/internal/command/user_test.go b/internal/command/user_test.go index 5431f9265d..bb1a1bb097 100644 --- a/internal/command/user_test.go +++ b/internal/command/user_test.go @@ -257,6 +257,7 @@ func TestCommandSide_UsernameChange(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewRemoveUsernameUniqueConstraint("username", "org1", true)), uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username1", "org1", true)), ), @@ -414,6 +415,7 @@ func TestCommandSide_DeactivateUser(t *testing.T) { ), ), }, + nil, ), ), }, @@ -567,6 +569,7 @@ func TestCommandSide_ReactivateUser(t *testing.T) { ), ), }, + nil, ), ), }, @@ -721,6 +724,7 @@ func TestCommandSide_LockUser(t *testing.T) { ), ), }, + nil, ), ), }, @@ -874,6 +878,7 @@ func TestCommandSide_UnlockUser(t *testing.T) { ), ), }, + nil, ), ), }, @@ -1036,6 +1041,7 @@ func TestCommandSide_RemoveUser(t *testing.T) { ), ), }, + nil, uniqueConstraintsFromEventConstraint(user.NewRemoveUsernameUniqueConstraint("username", "org1", true)), ), ), @@ -1231,6 +1237,7 @@ func TestCommandSide_UserDomainClaimedSent(t *testing.T) { ), ), }, + nil, ), ), }, diff --git a/internal/eventstore/event.go b/internal/eventstore/event.go index 578c047f49..420cdbeb8e 100644 --- a/internal/eventstore/event.go +++ b/internal/eventstore/event.go @@ -20,6 +20,8 @@ type EventPusher interface { // * struct which can be marshalled to json // * pointer to struct which can be marshalled to json Data() interface{} + //Assets contain assets in form of []byte, these will be stored to a separate table + Assets() []*Asset //UniqueConstraints should be added for unique attributes of an event, if nil constraints will not be checked UniqueConstraints() []*EventUniqueConstraint } diff --git a/internal/eventstore/eventstore.go b/internal/eventstore/eventstore.go index ca1ec312bf..bf517e0f2d 100644 --- a/internal/eventstore/eventstore.go +++ b/internal/eventstore/eventstore.go @@ -39,11 +39,11 @@ func (es *Eventstore) Health(ctx context.Context) error { //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) + events, assets, constraints, err := eventsToRepository(pushEvents) if err != nil { return nil, err } - err = es.repo.Push(ctx, events, constraints...) + err = es.repo.Push(ctx, events, assets, constraints...) if err != nil { return nil, err } @@ -57,12 +57,12 @@ func (es *Eventstore) PushEvents(ctx context.Context, pushEvents ...EventPusher) return eventReaders, nil } -func eventsToRepository(pushEvents []EventPusher) (events []*repository.Event, constraints []*repository.UniqueConstraint, err error) { +func eventsToRepository(pushEvents []EventPusher) (events []*repository.Event, assets []*repository.Asset, 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 + return nil, nil, nil, err } events[i] = &repository.Event{ AggregateID: event.Aggregate().ID, @@ -77,9 +77,12 @@ func eventsToRepository(pushEvents []EventPusher) (events []*repository.Event, c if len(event.UniqueConstraints()) > 0 { constraints = append(constraints, uniqueConstraintsToRepository(event.UniqueConstraints())...) } + if len(event.Assets()) > 0 { + assets = append(assets, assetsToRepository(event.Assets())...) + } } - return events, constraints, nil + return events, assets, constraints, nil } func uniqueConstraintsToRepository(constraints []*EventUniqueConstraint) (uniqueConstraints []*repository.UniqueConstraint) { @@ -95,6 +98,18 @@ func uniqueConstraintsToRepository(constraints []*EventUniqueConstraint) (unique return uniqueConstraints } +func assetsToRepository(assets []*Asset) (result []*repository.Asset) { + result = make([]*repository.Asset, len(assets)) + for i, asset := range assets { + result[i] = &repository.Asset{ + ID: asset.ID, + Asset: asset.Asset, + Action: assetActionToRepository(asset.Action), + } + } + return result +} + //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) { @@ -229,3 +244,14 @@ func uniqueConstraintActionToRepository(action UniqueConstraintAction) repositor return repository.UniqueConstraintAdd } } + +func assetActionToRepository(action AssetAction) repository.AssetAction { + switch action { + case AssetAdd: + return repository.AssetAdded + case AssetRemove: + return repository.AssetRemoved + default: + return repository.AssetAdded + } +} diff --git a/internal/eventstore/eventstore_test.go b/internal/eventstore/eventstore_test.go index 59437de2f9..8a600fc946 100644 --- a/internal/eventstore/eventstore_test.go +++ b/internal/eventstore/eventstore_test.go @@ -68,6 +68,10 @@ func (e *testEvent) UniqueConstraints() []*EventUniqueConstraint { return nil } +func (e *testEvent) Assets() []*Asset { + return nil +} + func testFilterMapper(event *repository.Event) (EventReader, error) { if event == nil { return newTestEvent("testID", "hodor", nil, false), nil @@ -538,7 +542,7 @@ func TestEventstore_aggregatesToEvents(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - events, _, err := eventsToRepository(tt.args.events) + events, _, _, err := eventsToRepository(tt.args.events) if (err != nil) != tt.res.wantErr { t.Errorf("Eventstore.aggregatesToEvents() error = %v, wantErr %v", err, tt.res.wantErr) return @@ -571,7 +575,7 @@ func (repo *testRepo) Health(ctx context.Context) error { return nil } -func (repo *testRepo) Push(ctx context.Context, events []*repository.Event, uniqueConstraints ...*repository.UniqueConstraint) error { +func (repo *testRepo) Push(ctx context.Context, events []*repository.Event, assets []*repository.Asset, uniqueConstraints ...*repository.UniqueConstraint) error { if repo.err != nil { return repo.err } diff --git a/internal/eventstore/example_test.go b/internal/eventstore/example_test.go index 112c2a8e46..4d9bc3ebaf 100644 --- a/internal/eventstore/example_test.go +++ b/internal/eventstore/example_test.go @@ -66,6 +66,10 @@ func (e *UserAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint return nil } +func (e *UserAddedEvent) Assets() []*eventstore.Asset { + return nil +} + // ------------------------------------------------------------ // User first name changed event start // ------------------------------------------------------------ @@ -107,6 +111,10 @@ func (e *UserFirstNameChangedEvent) UniqueConstraints() []*eventstore.EventUniqu return nil } +func (e *UserFirstNameChangedEvent) Assets() []*eventstore.Asset { + return nil +} + // ------------------------------------------------------------ // User password checked event start // ------------------------------------------------------------ @@ -140,6 +148,10 @@ func (e *UserPasswordCheckedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *UserPasswordCheckedEvent) Assets() []*eventstore.Asset { + return nil +} + // ------------------------------------------------------------ // User deleted event // ------------------------------------------------------------ @@ -173,6 +185,10 @@ func (e *UserDeletedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai return nil } +func (e *UserDeletedEvent) Assets() []*eventstore.Asset { + return nil +} + // ------------------------------------------------------------ // Users read model start // ------------------------------------------------------------ diff --git a/internal/eventstore/repository/asset.go b/internal/eventstore/repository/asset.go new file mode 100644 index 0000000000..417d21c18c --- /dev/null +++ b/internal/eventstore/repository/asset.go @@ -0,0 +1,24 @@ +package repository + +//Asset represents all information about a asset (img) +type Asset struct { + // ID is to refer to the asset + ID string + //Asset is the actual image + Asset []byte + //Action defines if asset should be added or removed + Action AssetAction +} + +type AssetAction int32 + +const ( + AssetAdded AssetAction = iota + AssetRemoved + + assetCount +) + +func (f AssetAction) Valid() bool { + return f >= 0 && f < assetCount +} diff --git a/internal/eventstore/repository/mock/repository.mock.go b/internal/eventstore/repository/mock/repository.mock.go index 70f3d1283a..f7d6fdd2fd 100644 --- a/internal/eventstore/repository/mock/repository.mock.go +++ b/internal/eventstore/repository/mock/repository.mock.go @@ -79,10 +79,10 @@ func (mr *MockRepositoryMockRecorder) LatestSequence(arg0, arg1 interface{}) *go } // Push mocks base method -func (m *MockRepository) Push(arg0 context.Context, arg1 []*repository.Event, arg2 ...*repository.UniqueConstraint) error { +func (m *MockRepository) Push(arg0 context.Context, arg1 []*repository.Event, arg2 []*repository.Asset, arg3 ...*repository.UniqueConstraint) error { m.ctrl.T.Helper() - varargs := []interface{}{arg0, arg1} - for _, a := range arg2 { + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Push", varargs...) @@ -91,8 +91,8 @@ func (m *MockRepository) Push(arg0 context.Context, arg1 []*repository.Event, ar } // Push indicates an expected call of Push -func (mr *MockRepositoryMockRecorder) Push(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { +func (mr *MockRepositoryMockRecorder) Push(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{arg0, arg1}, arg2...) + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Push", reflect.TypeOf((*MockRepository)(nil).Push), varargs...) } diff --git a/internal/eventstore/repository/mock/repository.mock.impl.go b/internal/eventstore/repository/mock/repository.mock.impl.go index b698944503..c7dd84db9a 100644 --- a/internal/eventstore/repository/mock/repository.mock.impl.go +++ b/internal/eventstore/repository/mock/repository.mock.impl.go @@ -24,28 +24,32 @@ func (m *MockRepository) ExpectFilterEvents(events ...*repository.Event) *MockRe return m } -func (m *MockRepository) ExpectPush(expectedEvents []*repository.Event, expectedUniqueConstraints ...*repository.UniqueConstraint) *MockRepository { - m.EXPECT().Push(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn( - func(ctx context.Context, events []*repository.Event, uniqueConstraints ...*repository.UniqueConstraint) error { +func (m *MockRepository) ExpectPush(expectedEvents []*repository.Event, expectedAssets []*repository.Asset, expectedUniqueConstraints ...*repository.UniqueConstraint) *MockRepository { + m.EXPECT().Push(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn( + func(ctx context.Context, events []*repository.Event, assets []*repository.Asset, uniqueConstraints ...*repository.UniqueConstraint) error { assert.Equal(m.ctrl.T, expectedEvents, events) if expectedUniqueConstraints == nil { expectedUniqueConstraints = []*repository.UniqueConstraint{} } assert.Equal(m.ctrl.T, expectedUniqueConstraints, uniqueConstraints) + + assert.Equal(m.ctrl.T, expectedAssets, assets) return nil }, ) return m } -func (m *MockRepository) ExpectPushFailed(err error, expectedEvents []*repository.Event, expectedUniqueConstraints ...*repository.UniqueConstraint) *MockRepository { - m.EXPECT().Push(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn( - func(ctx context.Context, events []*repository.Event, uniqueConstraints ...*repository.UniqueConstraint) error { +func (m *MockRepository) ExpectPushFailed(err error, expectedEvents []*repository.Event, expectedAssets []*repository.Asset, expectedUniqueConstraints ...*repository.UniqueConstraint) *MockRepository { + m.EXPECT().Push(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn( + func(ctx context.Context, events []*repository.Event, assets []*repository.Asset, uniqueConstraints ...*repository.UniqueConstraint) error { assert.Equal(m.ctrl.T, expectedEvents, events) if expectedUniqueConstraints == nil { expectedUniqueConstraints = []*repository.UniqueConstraint{} } assert.Equal(m.ctrl.T, expectedUniqueConstraints, uniqueConstraints) + + assert.Equal(m.ctrl.T, expectedAssets, assets) return err }, ) diff --git a/internal/eventstore/repository/repository.go b/internal/eventstore/repository/repository.go index 74d05ff0fc..566c5d6282 100644 --- a/internal/eventstore/repository/repository.go +++ b/internal/eventstore/repository/repository.go @@ -9,9 +9,10 @@ type Repository interface { //Health checks if the connection to the storage is available Health(ctx context.Context) error // PushEvents adds all events of the given aggregates to the eventstreams of the aggregates. + // if assets are pushed, they will be added to the assets table only referenced by id in eventstore (history) // if unique constraints are pushed, they will be added to the unique table for checking unique constraint violations // This call is transaction save. The transaction will be rolled back if one event fails - Push(ctx context.Context, events []*Event, uniqueConstraints ...*UniqueConstraint) error + Push(ctx context.Context, events []*Event, assets []*Asset, uniqueConstraints ...*UniqueConstraint) error // Filter returns all events matching the given search query Filter(ctx context.Context, searchQuery *SearchQuery) (events []*Event, err error) //LatestSequence returns the latests sequence found by the the search query diff --git a/internal/eventstore/repository/sql/crdb.go b/internal/eventstore/repository/sql/crdb.go index 7d1a18f566..dc49316ae7 100644 --- a/internal/eventstore/repository/sql/crdb.go +++ b/internal/eventstore/repository/sql/crdb.go @@ -97,9 +97,19 @@ const ( $1, $2 )` - uniqueDelete = `DELETE FROM eventstore.unique_constraints WHERE unique_type = $1 and unique_field = $2` + assetInsert = `INSERT INTO eventstore.assets + ( + id, + asset + ) + VALUES ( + $1, + $2 + )` + assetDelete = `DELETE FROM eventstore.assets + WHERE id = $1` ) type CRDB struct { @@ -114,7 +124,7 @@ func (db *CRDB) Health(ctx context.Context) error { return db.client.Ping() } // Push adds all events to the eventstreams of the aggregates. // This call is transaction save. The transaction will be rolled back if one event fails -func (db *CRDB) Push(ctx context.Context, events []*repository.Event, uniqueConstraints ...*repository.UniqueConstraint) error { +func (db *CRDB) Push(ctx context.Context, events []*repository.Event, assets []*repository.Asset, uniqueConstraints ...*repository.UniqueConstraint) error { err := crdb.ExecuteTx(ctx, db.client, nil, func(tx *sql.Tx) error { stmt, err := tx.PrepareContext(ctx, crdbInsert) if err != nil { @@ -152,6 +162,11 @@ func (db *CRDB) Push(ctx context.Context, events []*repository.Event, uniqueCons if err != nil { return err } + + err = db.handleAssets(ctx, tx, assets...) + if err != nil { + return err + } return nil }) if err != nil && !errors.Is(err, &caos_errs.CaosError{}) { @@ -194,6 +209,32 @@ func (db *CRDB) handleUniqueConstraints(ctx context.Context, tx *sql.Tx, uniqueC return nil } +// handleAssets adds or removes an asset +func (db *CRDB) handleAssets(ctx context.Context, tx *sql.Tx, assets ...*repository.Asset) (err error) { + if assets == nil || len(assets) == 0 || (len(assets) == 1 && assets[0] == nil) { + return nil + } + + for _, asset := range assets { + if asset.Action == repository.AssetAdded { + _, err := tx.ExecContext(ctx, assetInsert, asset.ID, asset.Asset) + if err != nil { + logging.LogWithFields("SQL-M39fs", + "asset-id", asset.ID).WithError(err).Info("insert asset failed") + return caos_errs.ThrowInternal(err, "SQL-4M0gs", "unable to create asset") + } + } else if asset.Action == repository.AssetRemoved { + _, err := tx.ExecContext(ctx, assetDelete, asset.ID) + if err != nil { + logging.LogWithFields("SQL-3M9fs", + "asset-id", asset.ID).WithError(err).Info("delete asset failed") + return caos_errs.ThrowInternal(err, "SQL-Md9ds", "unable to remove unique constraint ") + } + } + } + return nil +} + // Filter returns all events matching the given search query func (db *CRDB) Filter(ctx context.Context, searchQuery *repository.SearchQuery) (events []*repository.Event, err error) { events = []*repository.Event{} diff --git a/internal/eventstore/repository/sql/crdb_test.go b/internal/eventstore/repository/sql/crdb_test.go index 3c67813a8d..d07d07d431 100644 --- a/internal/eventstore/repository/sql/crdb_test.go +++ b/internal/eventstore/repository/sql/crdb_test.go @@ -5,9 +5,10 @@ import ( "sync" "testing" - "github.com/caos/zitadel/internal/eventstore/repository" "github.com/lib/pq" _ "github.com/lib/pq" + + "github.com/caos/zitadel/internal/eventstore/repository" ) func TestCRDB_placeholder(t *testing.T) { @@ -269,12 +270,16 @@ func TestCRDB_Push_OneAggregate(t *testing.T) { ctx context.Context events []*repository.Event uniqueConstraints *repository.UniqueConstraint + assets *repository.Asset uniqueDataType string uniqueDataField string + assetID string + asset []byte } type eventsRes struct { pushedEventsCount int uniqueCount int + assetCount int aggType repository.AggregateType aggID []string } @@ -376,6 +381,46 @@ func TestCRDB_Push_OneAggregate(t *testing.T) { aggType: repository.AggregateType(t.Name()), }}, }, + { + name: "push 1 event and add asset", + args: args{ + ctx: context.Background(), + events: []*repository.Event{ + generateEvent(t, "12"), + }, + assets: generateAddAsset(t, "asset12", []byte{1}), + assetID: "asset12", + asset: []byte{1}, + }, + res: res{ + wantErr: false, + eventsRes: eventsRes{ + pushedEventsCount: 1, + assetCount: 1, + aggID: []string{"12"}, + aggType: repository.AggregateType(t.Name()), + }}, + }, + { + name: "push 1 event and remove asset", + args: args{ + ctx: context.Background(), + events: []*repository.Event{ + generateEvent(t, "13"), + }, + assets: generateRemoveAsset(t, "asset13"), + assetID: "asset13", + asset: []byte{1}, + }, + res: res{ + wantErr: false, + eventsRes: eventsRes{ + pushedEventsCount: 1, + assetCount: 0, + aggID: []string{"13"}, + aggType: repository.AggregateType(t.Name()), + }}, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -389,7 +434,14 @@ func TestCRDB_Push_OneAggregate(t *testing.T) { return } } - if err := db.Push(tt.args.ctx, tt.args.events, tt.args.uniqueConstraints); (err != nil) != tt.res.wantErr { + if tt.args.uniqueDataType != "" && tt.args.uniqueDataField != "" { + err := fillAssets(tt.args.assetID, tt.args.asset) + if err != nil { + t.Error("unable to prefill insert unique data: ", err) + return + } + } + if err := db.Push(tt.args.ctx, tt.args.events, []*repository.Asset{tt.args.assets}, tt.args.uniqueConstraints); (err != nil) != tt.res.wantErr { t.Errorf("CRDB.Push() error = %v, wantErr %v", err, tt.res.wantErr) } @@ -415,7 +467,18 @@ func TestCRDB_Push_OneAggregate(t *testing.T) { t.Errorf("expected unique count %d got %d", tt.res.eventsRes.uniqueCount, uniqueCount) } } - + if tt.args.assets != nil { + countAssetRow := testCRDBClient.QueryRow("SELECT COUNT(*) FROM eventstore.assets where id = $1", tt.args.assets.ID) + var assetCount int + err := countAssetRow.Scan(&assetCount) + if err != nil { + t.Error("unable to query inserted rows: ", err) + return + } + if assetCount != tt.res.eventsRes.assetCount { + t.Errorf("expected asset count %d got %d", tt.res.eventsRes.assetCount, assetCount) + } + } }) } } @@ -423,6 +486,7 @@ func TestCRDB_Push_OneAggregate(t *testing.T) { func TestCRDB_Push_MultipleAggregate(t *testing.T) { type args struct { events []*repository.Event + assets []*repository.Asset } type eventsRes struct { pushedEventsCount int @@ -507,7 +571,7 @@ func TestCRDB_Push_MultipleAggregate(t *testing.T) { db := &CRDB{ client: testCRDBClient, } - if err := db.Push(context.Background(), tt.args.events); (err != nil) != tt.res.wantErr { + if err := db.Push(context.Background(), tt.args.events, tt.args.assets); (err != nil) != tt.res.wantErr { t.Errorf("CRDB.Push() error = %v, wantErr %v", err, tt.res.wantErr) } @@ -651,7 +715,7 @@ func TestCRDB_Push_Parallel(t *testing.T) { for _, events := range tt.args.events { wg.Add(1) go func(events []*repository.Event) { - err := db.Push(context.Background(), events) + err := db.Push(context.Background(), events, nil) if err != nil { errsMu.Lock() errs = append(errs, err) @@ -698,6 +762,7 @@ func TestCRDB_Filter(t *testing.T) { } type fields struct { existingEvents []*repository.Event + assets []*repository.Asset } type res struct { eventCount int @@ -763,7 +828,7 @@ func TestCRDB_Filter(t *testing.T) { } // setup initial data for query - if err := db.Push(context.Background(), tt.fields.existingEvents); err != nil { + if err := db.Push(context.Background(), tt.fields.existingEvents, tt.fields.assets); err != nil { t.Errorf("error in setup = %v", err) return } @@ -786,6 +851,7 @@ func TestCRDB_LatestSequence(t *testing.T) { } type fields struct { existingEvents []*repository.Event + existingAssets []*repository.Asset } type res struct { sequence uint64 @@ -849,7 +915,7 @@ func TestCRDB_LatestSequence(t *testing.T) { } // setup initial data for query - if err := db.Push(context.Background(), tt.fields.existingEvents); err != nil { + if err := db.Push(context.Background(), tt.fields.existingEvents, tt.fields.existingAssets); err != nil { t.Errorf("error in setup = %v", err) return } @@ -869,6 +935,7 @@ func TestCRDB_LatestSequence(t *testing.T) { func TestCRDB_Push_ResourceOwner(t *testing.T) { type args struct { events []*repository.Event + assets []*repository.Asset } type res struct { resourceOwners []string @@ -991,7 +1058,7 @@ func TestCRDB_Push_ResourceOwner(t *testing.T) { db := &CRDB{ client: testCRDBClient, } - if err := db.Push(context.Background(), tt.args.events); err != nil { + if err := db.Push(context.Background(), tt.args.events, tt.args.assets); err != nil { t.Errorf("CRDB.Push() error = %v", err) } @@ -1093,3 +1160,22 @@ func generateRemoveUniqueConstraint(t *testing.T, table, uniqueField string) *re return e } + +func generateAddAsset(t *testing.T, id string, asset []byte) *repository.Asset { + t.Helper() + e := &repository.Asset{ + ID: id, + Asset: asset, + Action: repository.AssetAdded, + } + return e +} + +func generateRemoveAsset(t *testing.T, id string) *repository.Asset { + t.Helper() + e := &repository.Asset{ + ID: id, + Action: repository.AssetRemoved, + } + return e +} diff --git a/internal/eventstore/repository/sql/local_crdb_test.go b/internal/eventstore/repository/sql/local_crdb_test.go index e67c314c4a..a06147eeed 100644 --- a/internal/eventstore/repository/sql/local_crdb_test.go +++ b/internal/eventstore/repository/sql/local_crdb_test.go @@ -100,6 +100,11 @@ func fillUniqueData(unique_type, field string) error { return err } +func fillAssets(id string, asset []byte) error { + _, err := testCRDBClient.Exec("INSERT INTO eventstore.assets (id, asset) VALUES ($1, $2)", id, asset) + return err +} + type migrationPaths []string type version struct { diff --git a/internal/eventstore/repository/sql/query_test.go b/internal/eventstore/repository/sql/query_test.go index 0a8f72f567..39370071c8 100644 --- a/internal/eventstore/repository/sql/query_test.go +++ b/internal/eventstore/repository/sql/query_test.go @@ -304,6 +304,7 @@ func Test_query_events_with_crdb(t *testing.T) { } type fields struct { existingEvents []*repository.Event + existingAssets []*repository.Asset client *sql.DB } type res struct { @@ -521,7 +522,7 @@ func Test_query_events_with_crdb(t *testing.T) { } // setup initial data for query - if err := db.Push(context.Background(), tt.fields.existingEvents); err != nil { + if err := db.Push(context.Background(), tt.fields.existingEvents, tt.fields.existingAssets); err != nil { t.Errorf("error in setup = %v", err) return } diff --git a/internal/repository/features/features.go b/internal/repository/features/features.go index 388a759368..79ea59f8b1 100644 --- a/internal/repository/features/features.go +++ b/internal/repository/features/features.go @@ -42,6 +42,10 @@ func (e *FeaturesSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai return nil } +func (e *FeaturesSetEvent) Assets() []*eventstore.Asset { + return nil +} + func NewFeaturesSetEvent( base *eventstore.BaseEvent, changes []FeaturesChanges, @@ -163,6 +167,10 @@ func (e *FeaturesRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *FeaturesRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewFeaturesRemovedEvent(base *eventstore.BaseEvent) *FeaturesRemovedEvent { return &FeaturesRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/iam/event_iam_project_set.go b/internal/repository/iam/event_iam_project_set.go index b975c83b3f..97dd28f21e 100644 --- a/internal/repository/iam/event_iam_project_set.go +++ b/internal/repository/iam/event_iam_project_set.go @@ -27,6 +27,10 @@ func (e *ProjectSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain return nil } +func (e *ProjectSetEvent) Assets() []*eventstore.Asset { + return nil +} + func NewIAMProjectSetEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/iam/event_org_set.go b/internal/repository/iam/event_org_set.go index 54887bd505..caa46d47c2 100644 --- a/internal/repository/iam/event_org_set.go +++ b/internal/repository/iam/event_org_set.go @@ -27,6 +27,10 @@ func (e *GlobalOrgSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstra return nil } +func (e *GlobalOrgSetEvent) Assets() []*eventstore.Asset { + return nil +} + func NewGlobalOrgSetEventEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/iam/events_step.go b/internal/repository/iam/events_step.go index 4705a5c762..60270982d9 100644 --- a/internal/repository/iam/events_step.go +++ b/internal/repository/iam/events_step.go @@ -52,6 +52,10 @@ func (e *SetupStepEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint } } +func (e *SetupStepEvent) Assets() []*eventstore.Asset { + return nil +} + func SetupStepMapper(event *repository.Event) (eventstore.EventReader, error) { step := &SetupStepEvent{ BaseEvent: *eventstore.BaseEventFromRepo(event), diff --git a/internal/repository/iam/migrate_unique_constraints.go b/internal/repository/iam/migrate_unique_constraints.go index 08868a95d8..3c9cf14d00 100644 --- a/internal/repository/iam/migrate_unique_constraints.go +++ b/internal/repository/iam/migrate_unique_constraints.go @@ -37,6 +37,10 @@ func (e *MigrateUniqueConstraintEvent) UniqueConstraints() []*eventstore.EventUn return constraints } +func (e *MigrateUniqueConstraintEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMigrateUniqueConstraintEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/idpconfig/idp_config.go b/internal/repository/idpconfig/idp_config.go index e022503e68..9abe1e9c9c 100644 --- a/internal/repository/idpconfig/idp_config.go +++ b/internal/repository/idpconfig/idp_config.go @@ -59,6 +59,10 @@ func (e *IDPConfigAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return []*eventstore.EventUniqueConstraint{NewAddIDPConfigNameUniqueConstraint(e.Name, e.Aggregate().ResourceOwner)} } +func (e *IDPConfigAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func IDPConfigAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) { e := &IDPConfigAddedEvent{ BaseEvent: *eventstore.BaseEventFromRepo(event), @@ -95,6 +99,10 @@ func (e *IDPConfigChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCon } } +func (e *IDPConfigChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewIDPConfigChangedEvent( base *eventstore.BaseEvent, configID, @@ -167,6 +175,10 @@ func (e *IDPConfigDeactivatedEvent) UniqueConstraints() []*eventstore.EventUniqu return nil } +func (e *IDPConfigDeactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func IDPConfigDeactivatedEventMapper(event *repository.Event) (eventstore.EventReader, error) { e := &IDPConfigDeactivatedEvent{ BaseEvent: *eventstore.BaseEventFromRepo(event), @@ -205,6 +217,10 @@ func (e *IDPConfigReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqu return nil } +func (e *IDPConfigReactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func IDPConfigReactivatedEventMapper(event *repository.Event) (eventstore.EventReader, error) { e := &IDPConfigReactivatedEvent{ BaseEvent: *eventstore.BaseEventFromRepo(event), @@ -246,6 +262,10 @@ func (e *IDPConfigRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return []*eventstore.EventUniqueConstraint{NewRemoveIDPConfigNameUniqueConstraint(e.Name, e.Aggregate().ResourceOwner)} } +func (e *IDPConfigRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func IDPConfigRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) { e := &IDPConfigRemovedEvent{ BaseEvent: *eventstore.BaseEventFromRepo(event), diff --git a/internal/repository/idpconfig/oidc_config.go b/internal/repository/idpconfig/oidc_config.go index ef7edf2150..298d2dc654 100644 --- a/internal/repository/idpconfig/oidc_config.go +++ b/internal/repository/idpconfig/oidc_config.go @@ -36,6 +36,10 @@ func (e *OIDCConfigAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *OIDCConfigAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOIDCConfigAddedEvent( base *eventstore.BaseEvent, clientID, @@ -94,6 +98,10 @@ func (e *OIDCConfigChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *OIDCConfigChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOIDCConfigChangedEvent( base *eventstore.BaseEvent, idpConfigID string, diff --git a/internal/repository/keypair/key_pair.go b/internal/repository/keypair/key_pair.go index fb825e71f9..4937219eef 100644 --- a/internal/repository/keypair/key_pair.go +++ b/internal/repository/keypair/key_pair.go @@ -38,6 +38,10 @@ func (e *AddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint { return nil } +func (e *AddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/member/events.go b/internal/repository/member/events.go index ba591c9e13..bb784dd5fd 100644 --- a/internal/repository/member/events.go +++ b/internal/repository/member/events.go @@ -44,6 +44,10 @@ func (e *MemberAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai return []*eventstore.EventUniqueConstraint{NewAddMemberUniqueConstraint(e.Aggregate().ID, e.UserID)} } +func (e *MemberAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMemberAddedEvent( base *eventstore.BaseEvent, userID string, @@ -85,6 +89,10 @@ func (e *MemberChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr return nil } +func (e *MemberChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMemberChangedEvent( base *eventstore.BaseEvent, userID string, @@ -124,6 +132,10 @@ func (e *MemberRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr return []*eventstore.EventUniqueConstraint{NewRemoveMemberUniqueConstraint(e.Aggregate().ID, e.UserID)} } +func (e *MemberRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewRemovedEvent( base *eventstore.BaseEvent, userID string, diff --git a/internal/repository/org/domain.go b/internal/repository/org/domain.go index 5e694116d4..d95948da24 100644 --- a/internal/repository/org/domain.go +++ b/internal/repository/org/domain.go @@ -49,6 +49,10 @@ func (e *DomainAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai return nil } +func (e *DomainAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewDomainAddedEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainAddedEvent { return &DomainAddedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -88,6 +92,10 @@ func (e *DomainVerificationAddedEvent) UniqueConstraints() []*eventstore.EventUn return nil } +func (e *DomainVerificationAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewDomainVerificationAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -132,6 +140,10 @@ func (e *DomainVerificationFailedEvent) UniqueConstraints() []*eventstore.EventU return nil } +func (e *DomainVerificationFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewDomainVerificationFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainVerificationFailedEvent { return &DomainVerificationFailedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -169,6 +181,10 @@ func (e *DomainVerifiedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return []*eventstore.EventUniqueConstraint{NewAddOrgDomainUniqueConstraint(e.Domain)} } +func (e *DomainVerifiedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewDomainVerifiedEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainVerifiedEvent { return &DomainVerifiedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -206,6 +222,10 @@ func (e *DomainPrimarySetEvent) UniqueConstraints() []*eventstore.EventUniqueCon return nil } +func (e *DomainPrimarySetEvent) Assets() []*eventstore.Asset { + return nil +} + func NewDomainPrimarySetEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string) *DomainPrimarySetEvent { return &DomainPrimarySetEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -247,6 +267,10 @@ func (e *DomainRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr return []*eventstore.EventUniqueConstraint{NewRemoveOrgDomainUniqueConstraint(e.Domain)} } +func (e *DomainRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewDomainRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, domain string, verified bool) *DomainRemovedEvent { return &DomainRemovedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( diff --git a/internal/repository/org/org.go b/internal/repository/org/org.go index ec96c5cedd..aa86a16cbf 100644 --- a/internal/repository/org/org.go +++ b/internal/repository/org/org.go @@ -45,6 +45,10 @@ func (e *OrgAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint return []*eventstore.EventUniqueConstraint{NewAddOrgNameUniqueConstraint(e.Name)} } +func (e *OrgAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOrgAddedEvent(ctx context.Context, aggregate *eventstore.Aggregate, name string) *OrgAddedEvent { return &OrgAddedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -86,6 +90,10 @@ func (e *OrgChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain } } +func (e *OrgChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOrgChangedEvent(ctx context.Context, aggregate *eventstore.Aggregate, oldName, newName string) *OrgChangedEvent { return &OrgChangedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -122,6 +130,10 @@ func (e *OrgDeactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return nil } +func (e *OrgDeactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOrgDeactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *OrgDeactivatedEvent { return &OrgDeactivatedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -156,6 +168,10 @@ func (e *OrgReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return nil } +func (e *OrgReactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOrgReactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *OrgReactivatedEvent { return &OrgReactivatedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -191,6 +207,10 @@ func (e *OrgRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain return []*eventstore.EventUniqueConstraint{NewRemoveOrgNameUniqueConstraint(e.name)} } +func (e *OrgRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOrgRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, name string) *OrgRemovedEvent { return &OrgRemovedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( diff --git a/internal/repository/policy/label.go b/internal/repository/policy/label.go index b53009724c..da5383be10 100644 --- a/internal/repository/policy/label.go +++ b/internal/repository/policy/label.go @@ -30,6 +30,10 @@ func (e *LabelPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return nil } +func (e *LabelPolicyAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewLabelPolicyAddedEvent( base *eventstore.BaseEvent, primaryColor, @@ -74,6 +78,10 @@ func (e *LabelPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *LabelPolicyChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewLabelPolicyChangedEvent( base *eventstore.BaseEvent, changes []LabelPolicyChanges, @@ -135,6 +143,10 @@ func (e *LabelPolicyRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *LabelPolicyRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewLabelPolicyRemovedEvent(base *eventstore.BaseEvent) *LabelPolicyRemovedEvent { return &LabelPolicyRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/policy/login.go b/internal/repository/policy/login.go index dbcfbfe9a7..cb72afa5aa 100644 --- a/internal/repository/policy/login.go +++ b/internal/repository/policy/login.go @@ -33,6 +33,10 @@ func (e *LoginPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return nil } +func (e *LoginPolicyAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewLoginPolicyAddedEvent( base *eventstore.BaseEvent, allowUserNamePassword, @@ -85,6 +89,10 @@ func (e *LoginPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *LoginPolicyChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewLoginPolicyChangedEvent( base *eventstore.BaseEvent, changes []LoginPolicyChanges, @@ -158,6 +166,10 @@ func (e *LoginPolicyRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *LoginPolicyRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewLoginPolicyRemovedEvent(base *eventstore.BaseEvent) *LoginPolicyRemovedEvent { return &LoginPolicyRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/policy/mail_template.go b/internal/repository/policy/mail_template.go index 05f68a3f6f..49c49d9531 100644 --- a/internal/repository/policy/mail_template.go +++ b/internal/repository/policy/mail_template.go @@ -29,6 +29,10 @@ func (e *MailTemplateAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *MailTemplateAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMailTemplateAddedEvent( base *eventstore.BaseEvent, template []byte, @@ -66,6 +70,10 @@ func (e *MailTemplateChangedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *MailTemplateChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMailTemplateChangedEvent( base *eventstore.BaseEvent, changes []MailTemplateChanges, @@ -115,6 +123,10 @@ func (e *MailTemplateRemovedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *MailTemplateRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMailTemplateRemovedEvent(base *eventstore.BaseEvent) *MailTemplateRemovedEvent { return &MailTemplateRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/policy/mail_text.go b/internal/repository/policy/mail_text.go index d3e5a1af75..baadac63bf 100644 --- a/internal/repository/policy/mail_text.go +++ b/internal/repository/policy/mail_text.go @@ -50,6 +50,10 @@ func (e *MailTextAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr return []*eventstore.EventUniqueConstraint{NewAddMailTextUniqueConstraint(e.Aggregate().ResourceOwner, e.MailTextType, e.Language)} } +func (e *MailTextAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMailTextAddedEvent( base *eventstore.BaseEvent, mailTextType, @@ -108,6 +112,10 @@ func (e *MailTextChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *MailTextChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMailTextChangedEvent( base *eventstore.BaseEvent, mailTextType, @@ -194,6 +202,10 @@ func (e *MailTextRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return []*eventstore.EventUniqueConstraint{NewRemoveMailTextUniqueConstraint(e.Aggregate().ResourceOwner, e.MailTextType, e.Language)} } +func (e *MailTextRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMailTextRemovedEvent(base *eventstore.BaseEvent, mailTextType, language string) *MailTextRemovedEvent { return &MailTextRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/policy/policy_login_factors.go b/internal/repository/policy/policy_login_factors.go index 02f4f72959..48cde4995b 100644 --- a/internal/repository/policy/policy_login_factors.go +++ b/internal/repository/policy/policy_login_factors.go @@ -55,6 +55,10 @@ func (e *SecondFactorAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *SecondFactorAddedEvent) Assets() []*eventstore.Asset { + return nil +} + type SecondFactorRemovedEvent struct { eventstore.BaseEvent `json:"-"` MFAType domain.SecondFactorType `json:"mfaType"` @@ -91,6 +95,10 @@ func (e *SecondFactorRemovedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *SecondFactorRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + type MultiFactorAddedEvent struct { eventstore.BaseEvent `json:"-"` @@ -128,6 +136,10 @@ func (e *MultiFactorAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return nil } +func (e *MultiFactorAddedEvent) Assets() []*eventstore.Asset { + return nil +} + type MultiFactorRemovedEvent struct { eventstore.BaseEvent `json:"-"` MFAType domain.MultiFactorType `json:"mfaType"` @@ -163,3 +175,7 @@ func (e *MultiFactorRemovedEvent) Data() interface{} { func (e *MultiFactorRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint { return nil } + +func (e *MultiFactorRemovedEvent) Assets() []*eventstore.Asset { + return nil +} diff --git a/internal/repository/policy/policy_login_identity_provider.go b/internal/repository/policy/policy_login_identity_provider.go index 2d64719944..c60072148f 100644 --- a/internal/repository/policy/policy_login_identity_provider.go +++ b/internal/repository/policy/policy_login_identity_provider.go @@ -30,6 +30,10 @@ func (e *IdentityProviderAddedEvent) UniqueConstraints() []*eventstore.EventUniq return nil } +func (e *IdentityProviderAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewIdentityProviderAddedEvent( base *eventstore.BaseEvent, idpConfigID string, @@ -70,6 +74,10 @@ func (e *IdentityProviderRemovedEvent) UniqueConstraints() []*eventstore.EventUn return nil } +func (e *IdentityProviderRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewIdentityProviderRemovedEvent( base *eventstore.BaseEvent, idpConfigID string, @@ -107,6 +115,10 @@ func (e *IdentityProviderCascadeRemovedEvent) UniqueConstraints() []*eventstore. return nil } +func (e *IdentityProviderCascadeRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewIdentityProviderCascadeRemovedEvent( base *eventstore.BaseEvent, idpConfigID string, diff --git a/internal/repository/policy/policy_org_iam.go b/internal/repository/policy/policy_org_iam.go index f85895495f..fe3b9db2c1 100644 --- a/internal/repository/policy/policy_org_iam.go +++ b/internal/repository/policy/policy_org_iam.go @@ -28,6 +28,10 @@ func (e *OrgIAMPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *OrgIAMPolicyAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOrgIAMPolicyAddedEvent( base *eventstore.BaseEvent, userLoginMustBeDomain bool, @@ -66,6 +70,10 @@ func (e *OrgIAMPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *OrgIAMPolicyChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOrgIAMPolicyChangedEvent( base *eventstore.BaseEvent, changes []OrgIAMPolicyChanges, @@ -115,6 +123,10 @@ func (e *OrgIAMPolicyRemovedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *OrgIAMPolicyRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOrgIAMPolicyRemovedEvent(base *eventstore.BaseEvent) *OrgIAMPolicyRemovedEvent { return &OrgIAMPolicyRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/policy/policy_password_age.go b/internal/repository/policy/policy_password_age.go index dde9004a3f..b18ad0e656 100644 --- a/internal/repository/policy/policy_password_age.go +++ b/internal/repository/policy/policy_password_age.go @@ -28,6 +28,10 @@ func (e *PasswordAgePolicyAddedEvent) UniqueConstraints() []*eventstore.EventUni return nil } +func (e *PasswordAgePolicyAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordAgePolicyAddedEvent( base *eventstore.BaseEvent, expireWarnDays, @@ -69,6 +73,10 @@ func (e *PasswordAgePolicyChangedEvent) UniqueConstraints() []*eventstore.EventU return nil } +func (e *PasswordAgePolicyChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordAgePolicyChangedEvent( base *eventstore.BaseEvent, changes []PasswordAgePolicyChanges, @@ -124,6 +132,10 @@ func (e *PasswordAgePolicyRemovedEvent) UniqueConstraints() []*eventstore.EventU return nil } +func (e *PasswordAgePolicyRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordAgePolicyRemovedEvent(base *eventstore.BaseEvent) *PasswordAgePolicyRemovedEvent { return &PasswordAgePolicyRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/policy/policy_password_complexity.go b/internal/repository/policy/policy_password_complexity.go index b1d65dba86..3731436c5d 100644 --- a/internal/repository/policy/policy_password_complexity.go +++ b/internal/repository/policy/policy_password_complexity.go @@ -32,6 +32,10 @@ func (e *PasswordComplexityPolicyAddedEvent) UniqueConstraints() []*eventstore.E return nil } +func (e *PasswordComplexityPolicyAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordComplexityPolicyAddedEvent( base *eventstore.BaseEvent, minLength uint64, @@ -81,6 +85,10 @@ func (e *PasswordComplexityPolicyChangedEvent) UniqueConstraints() []*eventstore return nil } +func (e *PasswordComplexityPolicyChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordComplexityPolicyChangedEvent( base *eventstore.BaseEvent, changes []PasswordComplexityPolicyChanges, @@ -154,6 +162,10 @@ func (e *PasswordComplexityPolicyRemovedEvent) UniqueConstraints() []*eventstore return nil } +func (e *PasswordComplexityPolicyRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordComplexityPolicyRemovedEvent(base *eventstore.BaseEvent) *PasswordComplexityPolicyRemovedEvent { return &PasswordComplexityPolicyRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/policy/policy_password_lockout.go b/internal/repository/policy/policy_password_lockout.go index fc8c46a2a6..a2ff7a37bd 100644 --- a/internal/repository/policy/policy_password_lockout.go +++ b/internal/repository/policy/policy_password_lockout.go @@ -29,6 +29,10 @@ func (e *PasswordLockoutPolicyAddedEvent) UniqueConstraints() []*eventstore.Even return nil } +func (e *PasswordLockoutPolicyAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordLockoutPolicyAddedEvent( base *eventstore.BaseEvent, maxAttempts uint64, @@ -70,6 +74,10 @@ func (e *PasswordLockoutPolicyChangedEvent) UniqueConstraints() []*eventstore.Ev return nil } +func (e *PasswordLockoutPolicyChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordLockoutPolicyChangedEvent( base *eventstore.BaseEvent, changes []PasswordLockoutPolicyChanges, @@ -125,6 +133,10 @@ func (e *PasswordLockoutPolicyRemovedEvent) UniqueConstraints() []*eventstore.Ev return nil } +func (e *PasswordLockoutPolicyRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewPasswordLockoutPolicyRemovedEvent(base *eventstore.BaseEvent) *PasswordLockoutPolicyRemovedEvent { return &PasswordLockoutPolicyRemovedEvent{ BaseEvent: *base, diff --git a/internal/repository/project/api_config.go b/internal/repository/project/api_config.go index bffed7e30a..ab168c7c95 100644 --- a/internal/repository/project/api_config.go +++ b/internal/repository/project/api_config.go @@ -36,6 +36,10 @@ func (e *APIConfigAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return nil } +func (e *APIConfigAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewAPIConfigAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -86,6 +90,10 @@ func (e *APIConfigChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return nil } +func (e *APIConfigChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewAPIConfigChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -146,6 +154,10 @@ func (e *APIConfigSecretChangedEvent) UniqueConstraints() []*eventstore.EventUni return nil } +func (e *APIConfigSecretChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewAPIConfigSecretChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -190,6 +202,10 @@ func (e *APIConfigSecretCheckSucceededEvent) UniqueConstraints() []*eventstore.E return nil } +func (e *APIConfigSecretCheckSucceededEvent) Assets() []*eventstore.Asset { + return nil +} + func NewAPIConfigSecretCheckSucceededEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -232,6 +248,10 @@ func (e *APIConfigSecretCheckFailedEvent) UniqueConstraints() []*eventstore.Even return nil } +func (e *APIConfigSecretCheckFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewAPIConfigSecretCheckFailedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/project/application.go b/internal/repository/project/application.go index 1111feb853..6b50c9ca03 100644 --- a/internal/repository/project/application.go +++ b/internal/repository/project/application.go @@ -48,6 +48,10 @@ func (e *ApplicationAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return []*eventstore.EventUniqueConstraint{NewAddApplicationUniqueConstraint(e.Name, e.Aggregate().ID)} } +func (e *ApplicationAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewApplicationAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -97,6 +101,10 @@ func (e *ApplicationChangedEvent) UniqueConstraints() []*eventstore.EventUniqueC } } +func (e *ApplicationChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewApplicationChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -143,6 +151,10 @@ func (e *ApplicationDeactivatedEvent) UniqueConstraints() []*eventstore.EventUni return nil } +func (e *ApplicationDeactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewApplicationDeactivatedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -185,6 +197,10 @@ func (e *ApplicationReactivatedEvent) UniqueConstraints() []*eventstore.EventUni return nil } +func (e *ApplicationReactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewApplicationReactivatedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -228,6 +244,10 @@ func (e *ApplicationRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueC return []*eventstore.EventUniqueConstraint{NewRemoveApplicationUniqueConstraint(e.name, e.Aggregate().ID)} } +func (e *ApplicationRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewApplicationRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/project/grant.go b/internal/repository/project/grant.go index 458b3cff6b..aeb151e443 100644 --- a/internal/repository/project/grant.go +++ b/internal/repository/project/grant.go @@ -50,6 +50,10 @@ func (e *GrantAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain return []*eventstore.EventUniqueConstraint{NewAddProjectGrantUniqueConstraint(e.GrantedOrgID, e.Aggregate().ID)} } +func (e *GrantAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewGrantAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -97,6 +101,10 @@ func (e *GrantChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstra return nil } +func (e *GrantChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewGrantChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -142,6 +150,10 @@ func (e *GrantCascadeChangedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *GrantCascadeChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewGrantCascadeChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -186,6 +198,10 @@ func (e *GrantDeactivateEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *GrantDeactivateEvent) Assets() []*eventstore.Asset { + return nil +} + func NewGrantDeactivateEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -228,6 +244,10 @@ func (e *GrantReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return nil } +func (e *GrantReactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewGrantReactivatedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -271,6 +291,10 @@ func (e *GrantRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstra return []*eventstore.EventUniqueConstraint{NewRemoveProjectGrantUniqueConstraint(e.grantedOrgID, e.Aggregate().ID)} } +func (e *GrantRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewGrantRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/project/grant_member.go b/internal/repository/project/grant_member.go index 30582d2fd7..4193896b4f 100644 --- a/internal/repository/project/grant_member.go +++ b/internal/repository/project/grant_member.go @@ -48,6 +48,10 @@ func (e *GrantMemberAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return []*eventstore.EventUniqueConstraint{NewAddProjectGrantMemberUniqueConstraint(e.Aggregate().ID, e.UserID, e.GrantID)} } +func (e *GrantMemberAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewProjectGrantMemberAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -96,6 +100,10 @@ func (e *GrantMemberChangedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *GrantMemberChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewProjectGrantMemberChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -143,6 +151,10 @@ func (e *GrantMemberRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueC return []*eventstore.EventUniqueConstraint{NewRemoveProjectGrantMemberUniqueConstraint(e.Aggregate().ID, e.UserID, e.GrantID)} } +func (e *GrantMemberRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewProjectGrantMemberRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/project/key.go b/internal/repository/project/key.go index eff24e1eab..e29e79016f 100644 --- a/internal/repository/project/key.go +++ b/internal/repository/project/key.go @@ -36,6 +36,10 @@ func (e *ApplicationKeyAddedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *ApplicationKeyAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewApplicationKeyAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -88,6 +92,10 @@ func (e *ApplicationKeyRemovedEvent) UniqueConstraints() []*eventstore.EventUniq return nil } +func (e *ApplicationKeyRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewApplicationKeyRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/project/oidc_config.go b/internal/repository/project/oidc_config.go index 2c2996799b..ac72759f7e 100644 --- a/internal/repository/project/oidc_config.go +++ b/internal/repository/project/oidc_config.go @@ -49,6 +49,10 @@ func (e *OIDCConfigAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *OIDCConfigAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOIDCConfigAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -134,6 +138,10 @@ func (e *OIDCConfigChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *OIDCConfigChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOIDCConfigChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -266,6 +274,10 @@ func (e *OIDCConfigSecretChangedEvent) UniqueConstraints() []*eventstore.EventUn return nil } +func (e *OIDCConfigSecretChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOIDCConfigSecretChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -310,6 +322,10 @@ func (e *OIDCConfigSecretCheckSucceededEvent) UniqueConstraints() []*eventstore. return nil } +func (e *OIDCConfigSecretCheckSucceededEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOIDCConfigSecretCheckSucceededEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -352,6 +368,10 @@ func (e *OIDCConfigSecretCheckFailedEvent) UniqueConstraints() []*eventstore.Eve return nil } +func (e *OIDCConfigSecretCheckFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewOIDCConfigSecretCheckFailedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/project/project.go b/internal/repository/project/project.go index faba643146..65bc7f456e 100644 --- a/internal/repository/project/project.go +++ b/internal/repository/project/project.go @@ -48,6 +48,10 @@ func (e *ProjectAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstra return []*eventstore.EventUniqueConstraint{NewAddProjectNameUniqueConstraint(e.Name, e.Aggregate().ResourceOwner)} } +func (e *ProjectAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewProjectAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -99,6 +103,10 @@ func (e *ProjectChangeEvent) UniqueConstraints() []*eventstore.EventUniqueConstr return nil } +func (e *ProjectChangeEvent) Assets() []*eventstore.Asset { + return nil +} + func NewProjectChangeEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -167,6 +175,10 @@ func (e *ProjectDeactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *ProjectDeactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewProjectDeactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *ProjectDeactivatedEvent { return &ProjectDeactivatedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -195,6 +207,10 @@ func (e *ProjectReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *ProjectReactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewProjectReactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *ProjectReactivatedEvent { return &ProjectReactivatedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -225,6 +241,10 @@ func (e *ProjectRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return []*eventstore.EventUniqueConstraint{NewRemoveProjectNameUniqueConstraint(e.Name, e.Aggregate().ResourceOwner)} } +func (e *ProjectRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewProjectRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/project/role.go b/internal/repository/project/role.go index 0efd08c3c8..48e585d39e 100644 --- a/internal/repository/project/role.go +++ b/internal/repository/project/role.go @@ -47,6 +47,10 @@ func (e *RoleAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint return []*eventstore.EventUniqueConstraint{NewAddProjectRoleUniqueConstraint(e.Key, e.Aggregate().ID)} } +func (e *RoleAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewRoleAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -95,6 +99,10 @@ func (e *RoleChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai return nil } +func (e *RoleChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewRoleChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -164,6 +172,10 @@ func (e *RoleRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai return []*eventstore.EventUniqueConstraint{NewRemoveProjectRoleUniqueConstraint(e.Key, e.Aggregate().ID)} } +func (e *RoleRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewRoleRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/human.go b/internal/repository/user/human.go index 67ca9a1070..28d4c3dcc0 100644 --- a/internal/repository/user/human.go +++ b/internal/repository/user/human.go @@ -59,6 +59,10 @@ func (e *HumanAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain return []*eventstore.EventUniqueConstraint{NewAddUsernameUniqueConstraint(e.UserName, e.Aggregate().ResourceOwner, e.userLoginMustBeDomain)} } +func (e *HumanAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func (e *HumanAddedEvent) AddAddressData( country, locality, @@ -166,6 +170,10 @@ func (e *HumanRegisteredEvent) UniqueConstraints() []*eventstore.EventUniqueCons return []*eventstore.EventUniqueConstraint{NewAddUsernameUniqueConstraint(e.UserName, e.Aggregate().ResourceOwner, e.userLoginMustBeDomain)} } +func (e *HumanRegisteredEvent) Assets() []*eventstore.Asset { + return nil +} + func (e *HumanRegisteredEvent) AddAddressData( country, locality, @@ -252,6 +260,10 @@ func (e *HumanInitialCodeAddedEvent) UniqueConstraints() []*eventstore.EventUniq return nil } +func (e *HumanInitialCodeAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanInitialCodeAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -293,6 +305,10 @@ func (e *HumanInitialCodeSentEvent) UniqueConstraints() []*eventstore.EventUniqu return nil } +func (e *HumanInitialCodeSentEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanInitialCodeSentEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanInitialCodeSentEvent { return &HumanInitialCodeSentEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -321,6 +337,10 @@ func (e *HumanInitializedCheckSucceededEvent) UniqueConstraints() []*eventstore. return nil } +func (e *HumanInitializedCheckSucceededEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanInitializedCheckSucceededEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanInitializedCheckSucceededEvent { return &HumanInitializedCheckSucceededEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -349,6 +369,10 @@ func (e *HumanInitializedCheckFailedEvent) UniqueConstraints() []*eventstore.Eve return nil } +func (e *HumanInitializedCheckFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanInitializedCheckFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanInitializedCheckFailedEvent { return &HumanInitializedCheckFailedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -379,6 +403,10 @@ func (e *HumanSignedOutEvent) UniqueConstraints() []*eventstore.EventUniqueConst return nil } +func (e *HumanSignedOutEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanSignedOutEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/human_address.go b/internal/repository/user/human_address.go index c902f80948..616572c45f 100644 --- a/internal/repository/user/human_address.go +++ b/internal/repository/user/human_address.go @@ -32,6 +32,10 @@ func (e *HumanAddressChangedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *HumanAddressChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewAddressChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/human_email.go b/internal/repository/user/human_email.go index 07e4955394..7f50f444b2 100644 --- a/internal/repository/user/human_email.go +++ b/internal/repository/user/human_email.go @@ -34,6 +34,10 @@ func (e *HumanEmailChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *HumanEmailChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanEmailChangedEvent(ctx context.Context, aggregate *eventstore.Aggregate, emailAddress string) *HumanEmailChangedEvent { return &HumanEmailChangedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -71,6 +75,10 @@ func (e *HumanEmailVerifiedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *HumanEmailVerifiedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanEmailVerifiedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanEmailVerifiedEvent { return &HumanEmailVerifiedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -101,6 +109,10 @@ func (e *HumanEmailVerificationFailedEvent) UniqueConstraints() []*eventstore.Ev return nil } +func (e *HumanEmailVerificationFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanEmailVerificationFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanEmailVerificationFailedEvent { return &HumanEmailVerificationFailedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -132,6 +144,10 @@ func (e *HumanEmailCodeAddedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *HumanEmailCodeAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanEmailCodeAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -172,6 +188,10 @@ func (e *HumanEmailCodeSentEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *HumanEmailCodeSentEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanEmailCodeSentEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanEmailCodeSentEvent { return &HumanEmailCodeSentEvent{ BaseEvent: *eventstore.NewBaseEventForPush( diff --git a/internal/repository/user/human_external_idp.go b/internal/repository/user/human_external_idp.go index 029412a3d4..a2d07ccf1e 100644 --- a/internal/repository/user/human_external_idp.go +++ b/internal/repository/user/human_external_idp.go @@ -50,6 +50,10 @@ func (e *HumanExternalIDPAddedEvent) UniqueConstraints() []*eventstore.EventUniq return []*eventstore.EventUniqueConstraint{NewAddExternalIDPUniqueConstraint(e.IDPConfigID, e.ExternalUserID)} } +func (e *HumanExternalIDPAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanExternalIDPAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -97,6 +101,10 @@ func (e *HumanExternalIDPRemovedEvent) UniqueConstraints() []*eventstore.EventUn return []*eventstore.EventUniqueConstraint{NewRemoveExternalIDPUniqueConstraint(e.IDPConfigID, e.ExternalUserID)} } +func (e *HumanExternalIDPRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanExternalIDPRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -142,6 +150,10 @@ func (e *HumanExternalIDPCascadeRemovedEvent) UniqueConstraints() []*eventstore. return []*eventstore.EventUniqueConstraint{NewRemoveExternalIDPUniqueConstraint(e.IDPConfigID, e.ExternalUserID)} } +func (e *HumanExternalIDPCascadeRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanExternalIDPCascadeRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -185,6 +197,10 @@ func (e *HumanExternalIDPCheckSucceededEvent) UniqueConstraints() []*eventstore. return nil } +func (e *HumanExternalIDPCheckSucceededEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanExternalIDPCheckSucceededEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/human_mfa_events.go b/internal/repository/user/human_mfa_events.go index 9728efc9db..b5d5fb84bb 100644 --- a/internal/repository/user/human_mfa_events.go +++ b/internal/repository/user/human_mfa_events.go @@ -24,6 +24,10 @@ func (e *HumanMFAInitSkippedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *HumanMFAInitSkippedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanMFAInitSkippedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanMFAInitSkippedEvent { return &HumanMFAInitSkippedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( diff --git a/internal/repository/user/human_mfa_otp.go b/internal/repository/user/human_mfa_otp.go index 6b4e61573a..8f1935b127 100644 --- a/internal/repository/user/human_mfa_otp.go +++ b/internal/repository/user/human_mfa_otp.go @@ -33,6 +33,10 @@ func (e *HumanOTPAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr return nil } +func (e *HumanOTPAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanOTPAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -72,6 +76,10 @@ func (e *HumanOTPVerifiedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return nil } +func (e *HumanOTPVerifiedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanOTPVerifiedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -105,6 +113,10 @@ func (e *HumanOTPRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *HumanOTPRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanOTPRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -137,6 +149,10 @@ func (e *HumanOTPCheckSucceededEvent) UniqueConstraints() []*eventstore.EventUni return nil } +func (e *HumanOTPCheckSucceededEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanOTPCheckSucceededEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -176,6 +192,10 @@ func (e *HumanOTPCheckFailedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *HumanOTPCheckFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanOTPCheckFailedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/human_mfa_web_auth_n.go b/internal/repository/user/human_mfa_web_auth_n.go index 69a9d4fe6e..f474e89b50 100644 --- a/internal/repository/user/human_mfa_web_auth_n.go +++ b/internal/repository/user/human_mfa_web_auth_n.go @@ -24,6 +24,10 @@ func (e *HumanWebAuthNAddedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *HumanWebAuthNAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanWebAuthNAddedEvent( base *eventstore.BaseEvent, webAuthNTokenID, @@ -68,6 +72,10 @@ func (e *HumanWebAuthNVerifiedEvent) UniqueConstraints() []*eventstore.EventUniq return nil } +func (e *HumanWebAuthNVerifiedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanWebAuthNVerifiedEvent( base *eventstore.BaseEvent, webAuthNTokenID, @@ -118,6 +126,10 @@ func (e *HumanWebAuthNSignCountChangedEvent) UniqueConstraints() []*eventstore.E return nil } +func (e *HumanWebAuthNSignCountChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanWebAuthNSignCountChangedEvent( base *eventstore.BaseEvent, webAuthNTokenID string, @@ -156,6 +168,10 @@ func (e *HumanWebAuthNRemovedEvent) UniqueConstraints() []*eventstore.EventUniqu return nil } +func (e *HumanWebAuthNRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanWebAuthNRemovedEvent( base *eventstore.BaseEvent, webAuthNTokenID string, @@ -194,6 +210,10 @@ func (e *HumanWebAuthNBeginLoginEvent) UniqueConstraints() []*eventstore.EventUn return nil } +func (e *HumanWebAuthNBeginLoginEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanWebAuthNBeginLoginEvent(base *eventstore.BaseEvent, challenge string, allowedCredentialIDs [][]byte, userVerification domain.UserVerificationRequirement, info *AuthRequestInfo) *HumanWebAuthNBeginLoginEvent { return &HumanWebAuthNBeginLoginEvent{ BaseEvent: *base, @@ -228,6 +248,10 @@ func (e *HumanWebAuthNCheckSucceededEvent) UniqueConstraints() []*eventstore.Eve return nil } +func (e *HumanWebAuthNCheckSucceededEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanWebAuthNCheckSucceededEvent( base *eventstore.BaseEvent, info *AuthRequestInfo) *HumanWebAuthNCheckSucceededEvent { @@ -261,6 +285,10 @@ func (e *HumanWebAuthNCheckFailedEvent) UniqueConstraints() []*eventstore.EventU return nil } +func (e *HumanWebAuthNCheckFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanWebAuthNCheckFailedEvent( base *eventstore.BaseEvent, info *AuthRequestInfo) *HumanWebAuthNCheckFailedEvent { diff --git a/internal/repository/user/human_password.go b/internal/repository/user/human_password.go index 3c67ad0e14..a4c16e7f4f 100644 --- a/internal/repository/user/human_password.go +++ b/internal/repository/user/human_password.go @@ -37,6 +37,10 @@ func (e *HumanPasswordChangedEvent) UniqueConstraints() []*eventstore.EventUniqu return nil } +func (e *HumanPasswordChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPasswordChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -84,6 +88,10 @@ func (e *HumanPasswordCodeAddedEvent) UniqueConstraints() []*eventstore.EventUni return nil } +func (e *HumanPasswordCodeAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPasswordCodeAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -127,6 +135,10 @@ func (e *HumanPasswordCodeSentEvent) UniqueConstraints() []*eventstore.EventUniq return nil } +func (e *HumanPasswordCodeSentEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPasswordCodeSentEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPasswordCodeSentEvent { return &HumanPasswordCodeSentEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -156,6 +168,10 @@ func (e *HumanPasswordCheckSucceededEvent) UniqueConstraints() []*eventstore.Eve return nil } +func (e *HumanPasswordCheckSucceededEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPasswordCheckSucceededEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -196,6 +212,10 @@ func (e *HumanPasswordCheckFailedEvent) UniqueConstraints() []*eventstore.EventU return nil } +func (e *HumanPasswordCheckFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPasswordCheckFailedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/human_phone.go b/internal/repository/user/human_phone.go index 9204cb8e4e..d3cecb4a43 100644 --- a/internal/repository/user/human_phone.go +++ b/internal/repository/user/human_phone.go @@ -35,6 +35,10 @@ func (e *HumanPhoneChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *HumanPhoneChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPhoneChangedEvent(ctx context.Context, aggregate *eventstore.Aggregate, phone string) *HumanPhoneChangedEvent { return &HumanPhoneChangedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -70,6 +74,10 @@ func (e *HumanPhoneRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *HumanPhoneRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPhoneRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPhoneRemovedEvent { return &HumanPhoneRemovedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -100,6 +108,10 @@ func (e *HumanPhoneVerifiedEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *HumanPhoneVerifiedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPhoneVerifiedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPhoneVerifiedEvent { return &HumanPhoneVerifiedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -129,6 +141,10 @@ func (e *HumanPhoneVerificationFailedEvent) UniqueConstraints() []*eventstore.Ev return nil } +func (e *HumanPhoneVerificationFailedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPhoneVerificationFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPhoneVerificationFailedEvent { return &HumanPhoneVerificationFailedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -160,6 +176,10 @@ func (e *HumanPhoneCodeAddedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *HumanPhoneCodeAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPhoneCodeAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -201,6 +221,10 @@ func (e *HumanPhoneCodeSentEvent) UniqueConstraints() []*eventstore.EventUniqueC return nil } +func (e *HumanPhoneCodeSentEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanPhoneCodeSentEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPhoneCodeSentEvent { return &HumanPhoneCodeSentEvent{ BaseEvent: *eventstore.NewBaseEventForPush( diff --git a/internal/repository/user/human_profile.go b/internal/repository/user/human_profile.go index 1ee977ec32..a62bf7792c 100644 --- a/internal/repository/user/human_profile.go +++ b/internal/repository/user/human_profile.go @@ -35,6 +35,10 @@ func (e *HumanProfileChangedEvent) UniqueConstraints() []*eventstore.EventUnique return nil } +func (e *HumanProfileChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewHumanProfileChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/machine.go b/internal/repository/user/machine.go index 389c693b92..22e8af033d 100644 --- a/internal/repository/user/machine.go +++ b/internal/repository/user/machine.go @@ -33,6 +33,10 @@ func (e *MachineAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstra return []*eventstore.EventUniqueConstraint{NewAddUsernameUniqueConstraint(e.UserName, e.Aggregate().ResourceOwner, e.userLoginMustBeDomain)} } +func (e *MachineAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMachineAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -81,6 +85,10 @@ func (e *MachineChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return nil } +func (e *MachineChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMachineChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/machine_key.go b/internal/repository/user/machine_key.go index d000226b3d..0901196cd2 100644 --- a/internal/repository/user/machine_key.go +++ b/internal/repository/user/machine_key.go @@ -34,6 +34,10 @@ func (e *MachineKeyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *MachineKeyAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMachineKeyAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -81,6 +85,10 @@ func (e *MachineKeyRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *MachineKeyRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewMachineKeyRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/user/user.go b/internal/repository/user/user.go index a7a6c8d14d..0daf5db480 100644 --- a/internal/repository/user/user.go +++ b/internal/repository/user/user.go @@ -57,6 +57,10 @@ func (e *UserLockedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain return nil } +func (e *UserLockedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserLockedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *UserLockedEvent { return &UserLockedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -85,6 +89,10 @@ func (e *UserUnlockedEvent) UniqueConstraints() []*eventstore.EventUniqueConstra return nil } +func (e *UserUnlockedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserUnlockedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *UserUnlockedEvent { return &UserUnlockedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -113,6 +121,10 @@ func (e *UserDeactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *UserDeactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserDeactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *UserDeactivatedEvent { return &UserDeactivatedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -141,6 +153,10 @@ func (e *UserReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueCons return nil } +func (e *UserReactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserReactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *UserReactivatedEvent { return &UserReactivatedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -172,6 +188,10 @@ func (e *UserRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai return []*eventstore.EventUniqueConstraint{NewRemoveUsernameUniqueConstraint(e.userName, e.Aggregate().ResourceOwner, e.loginMustBeDomain)} } +func (e *UserRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -215,6 +235,10 @@ func (e *UserTokenAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return nil } +func (e *UserTokenAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserTokenAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -273,6 +297,10 @@ func (e *DomainClaimedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr } } +func (e *DomainClaimedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewDomainClaimedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -316,6 +344,10 @@ func (e *DomainClaimedSentEvent) UniqueConstraints() []*eventstore.EventUniqueCo return nil } +func (e *DomainClaimedSentEvent) Assets() []*eventstore.Asset { + return nil +} + func NewDomainClaimedSentEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -354,6 +386,10 @@ func (e *UsernameChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCons } } +func (e *UsernameChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUsernameChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, diff --git a/internal/repository/usergrant/user_grant.go b/internal/repository/usergrant/user_grant.go index ed3deaf8f2..f3706aec99 100644 --- a/internal/repository/usergrant/user_grant.go +++ b/internal/repository/usergrant/user_grant.go @@ -52,6 +52,10 @@ func (e *UserGrantAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConst return []*eventstore.EventUniqueConstraint{NewAddUserGrantUniqueConstraint(e.Aggregate().ResourceOwner, e.UserID, e.ProjectID, e.ProjectGrantID)} } +func (e *UserGrantAddedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserGrantAddedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -98,6 +102,10 @@ func (e *UserGrantChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return nil } +func (e *UserGrantChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserGrantChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -138,6 +146,10 @@ func (e *UserGrantCascadeChangedEvent) UniqueConstraints() []*eventstore.EventUn return nil } +func (e *UserGrantCascadeChangedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserGrantCascadeChangedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -180,6 +192,10 @@ func (e *UserGrantRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueCon return []*eventstore.EventUniqueConstraint{NewRemoveUserGrantUniqueConstraint(e.Aggregate().ResourceOwner, e.userID, e.projectID, e.projectGrantID)} } +func (e *UserGrantRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserGrantRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -220,6 +236,10 @@ func (e *UserGrantCascadeRemovedEvent) UniqueConstraints() []*eventstore.EventUn return []*eventstore.EventUniqueConstraint{NewRemoveUserGrantUniqueConstraint(e.Aggregate().ResourceOwner, e.userID, e.projectID, e.projectGrantID)} } +func (e *UserGrantCascadeRemovedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserGrantCascadeRemovedEvent( ctx context.Context, aggregate *eventstore.Aggregate, @@ -257,6 +277,10 @@ func (e *UserGrantDeactivatedEvent) UniqueConstraints() []*eventstore.EventUniqu return nil } +func (e *UserGrantDeactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserGrantDeactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *UserGrantDeactivatedEvent { return &UserGrantDeactivatedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( @@ -285,6 +309,10 @@ func (e *UserGrantReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqu return nil } +func (e *UserGrantReactivatedEvent) Assets() []*eventstore.Asset { + return nil +} + func NewUserGrantReactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *UserGrantReactivatedEvent { return &UserGrantReactivatedEvent{ BaseEvent: *eventstore.NewBaseEventForPush( diff --git a/migrations/cockroach/V1.42__assets.sql b/migrations/cockroach/V1.42__assets.sql new file mode 100644 index 0000000000..7f865c327e --- /dev/null +++ b/migrations/cockroach/V1.42__assets.sql @@ -0,0 +1,7 @@ +CREATE TABLE eventstore.assets ( + id TEXT, + asset TEXT, + PRIMARY KEY (id) +); + +GRANT DELETE ON TABLE eventstore.assets to eventstore;