feat: add assets to eventstore and event (#1674)

* fix: add assets to eventstore and event

* fix: project member, grant member, app changed tests

* fix: asset migrations

* feat: add asset tests

* feat: add asset tests

* Update internal/eventstore/repository/repository.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* feat: add asset tests

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2021-04-27 12:58:18 +02:00
committed by GitHub
parent eaf966e3d2
commit f51f0ede5c
102 changed files with 1079 additions and 34 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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(

View File

@@ -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,

View File

@@ -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(

View File

@@ -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,

View File

@@ -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 {

View File

@@ -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,

View File

@@ -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(

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,