feat: asset storage (#1696)

* feat: remove assets

* feat: minio implementation

* fix: remove assets from tests

* feat: minio implementation

* feat: Env vars

* fix: sprintf

* fix: sprintf

* Update internal/eventstore/repository/repository.go

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

* fix: error handling

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2021-05-03 10:15:50 +02:00
committed by GitHub
parent a5c6bf5498
commit 667cc30291
110 changed files with 306 additions and 938 deletions

View File

@@ -59,10 +59,6 @@ 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,
@@ -170,10 +166,6 @@ 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,
@@ -260,10 +252,6 @@ func (e *HumanInitialCodeAddedEvent) UniqueConstraints() []*eventstore.EventUniq
return nil
}
func (e *HumanInitialCodeAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanInitialCodeAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -305,10 +293,6 @@ 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(
@@ -337,10 +321,6 @@ 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(
@@ -369,10 +349,6 @@ 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(
@@ -403,10 +379,6 @@ 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,10 +32,6 @@ 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,10 +34,6 @@ 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(
@@ -75,10 +71,6 @@ 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(
@@ -109,10 +101,6 @@ 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(
@@ -144,10 +132,6 @@ func (e *HumanEmailCodeAddedEvent) UniqueConstraints() []*eventstore.EventUnique
return nil
}
func (e *HumanEmailCodeAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanEmailCodeAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -188,10 +172,6 @@ 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,10 +50,6 @@ 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,
@@ -101,10 +97,6 @@ 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,
@@ -150,10 +142,6 @@ 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,
@@ -197,10 +185,6 @@ 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,10 +24,6 @@ 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,10 +33,6 @@ func (e *HumanOTPAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr
return nil
}
func (e *HumanOTPAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanOTPAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -76,10 +72,6 @@ func (e *HumanOTPVerifiedEvent) UniqueConstraints() []*eventstore.EventUniqueCon
return nil
}
func (e *HumanOTPVerifiedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanOTPVerifiedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -113,10 +105,6 @@ func (e *HumanOTPRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueCons
return nil
}
func (e *HumanOTPRemovedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanOTPRemovedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -149,10 +137,6 @@ func (e *HumanOTPCheckSucceededEvent) UniqueConstraints() []*eventstore.EventUni
return nil
}
func (e *HumanOTPCheckSucceededEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanOTPCheckSucceededEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -192,10 +176,6 @@ 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,10 +24,6 @@ func (e *HumanWebAuthNAddedEvent) UniqueConstraints() []*eventstore.EventUniqueC
return nil
}
func (e *HumanWebAuthNAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanWebAuthNAddedEvent(
base *eventstore.BaseEvent,
webAuthNTokenID,
@@ -72,10 +68,6 @@ func (e *HumanWebAuthNVerifiedEvent) UniqueConstraints() []*eventstore.EventUniq
return nil
}
func (e *HumanWebAuthNVerifiedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanWebAuthNVerifiedEvent(
base *eventstore.BaseEvent,
webAuthNTokenID,
@@ -126,10 +118,6 @@ func (e *HumanWebAuthNSignCountChangedEvent) UniqueConstraints() []*eventstore.E
return nil
}
func (e *HumanWebAuthNSignCountChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanWebAuthNSignCountChangedEvent(
base *eventstore.BaseEvent,
webAuthNTokenID string,
@@ -168,10 +156,6 @@ func (e *HumanWebAuthNRemovedEvent) UniqueConstraints() []*eventstore.EventUniqu
return nil
}
func (e *HumanWebAuthNRemovedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanWebAuthNRemovedEvent(
base *eventstore.BaseEvent,
webAuthNTokenID string,
@@ -210,10 +194,6 @@ 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,
@@ -248,10 +228,6 @@ func (e *HumanWebAuthNCheckSucceededEvent) UniqueConstraints() []*eventstore.Eve
return nil
}
func (e *HumanWebAuthNCheckSucceededEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanWebAuthNCheckSucceededEvent(
base *eventstore.BaseEvent,
info *AuthRequestInfo) *HumanWebAuthNCheckSucceededEvent {
@@ -285,10 +261,6 @@ 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,10 +37,6 @@ func (e *HumanPasswordChangedEvent) UniqueConstraints() []*eventstore.EventUniqu
return nil
}
func (e *HumanPasswordChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanPasswordChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -88,10 +84,6 @@ func (e *HumanPasswordCodeAddedEvent) UniqueConstraints() []*eventstore.EventUni
return nil
}
func (e *HumanPasswordCodeAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanPasswordCodeAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -135,10 +127,6 @@ 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(
@@ -168,10 +156,6 @@ func (e *HumanPasswordCheckSucceededEvent) UniqueConstraints() []*eventstore.Eve
return nil
}
func (e *HumanPasswordCheckSucceededEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanPasswordCheckSucceededEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -212,10 +196,6 @@ 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,10 +35,6 @@ 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(
@@ -74,10 +70,6 @@ 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(
@@ -108,10 +100,6 @@ 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(
@@ -141,10 +129,6 @@ 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(
@@ -176,10 +160,6 @@ func (e *HumanPhoneCodeAddedEvent) UniqueConstraints() []*eventstore.EventUnique
return nil
}
func (e *HumanPhoneCodeAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewHumanPhoneCodeAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -221,10 +201,6 @@ 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,10 +35,6 @@ 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,10 +33,6 @@ 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,
@@ -85,10 +81,6 @@ 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,10 +34,6 @@ func (e *MachineKeyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCons
return nil
}
func (e *MachineKeyAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewMachineKeyAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -85,10 +81,6 @@ 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,10 +57,6 @@ 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(
@@ -89,10 +85,6 @@ 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(
@@ -121,10 +113,6 @@ 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(
@@ -153,10 +141,6 @@ 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(
@@ -188,10 +172,6 @@ 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,
@@ -235,10 +215,6 @@ func (e *UserTokenAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConst
return nil
}
func (e *UserTokenAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewUserTokenAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -297,10 +273,6 @@ func (e *DomainClaimedEvent) UniqueConstraints() []*eventstore.EventUniqueConstr
}
}
func (e *DomainClaimedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewDomainClaimedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -344,10 +316,6 @@ func (e *DomainClaimedSentEvent) UniqueConstraints() []*eventstore.EventUniqueCo
return nil
}
func (e *DomainClaimedSentEvent) Assets() []*eventstore.Asset {
return nil
}
func NewDomainClaimedSentEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -386,10 +354,6 @@ func (e *UsernameChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCons
}
}
func (e *UsernameChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewUsernameChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,