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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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