fix: add v1 events (#1525)

* fix: add v1 events

* add v1 events to queries

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi 2021-04-06 09:57:58 +02:00 committed by GitHub
parent 27fcf4739d
commit d375ad4d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 75 additions and 458 deletions

View File

@ -200,6 +200,8 @@ func (rm *UniqueConstraintReadModel) Query() *eventstore.SearchQueryBuilder {
project.GrantMemberRemovedType, project.GrantMemberRemovedType,
project.RoleAddedType, project.RoleAddedType,
project.RoleRemovedType, project.RoleRemovedType,
user.UserV1AddedType,
user.UserV1RegisteredType,
user.HumanAddedType, user.HumanAddedType,
user.HumanRegisteredType, user.HumanRegisteredType,
user.MachineAddedEventType, user.MachineAddedEventType,

View File

@ -151,7 +151,9 @@ func (wm *UserGrantPreConditionReadModel) Reduce() error {
func (wm *UserGrantPreConditionReadModel) Query() *eventstore.SearchQueryBuilder { func (wm *UserGrantPreConditionReadModel) Query() *eventstore.SearchQueryBuilder {
query := eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, user.AggregateType, project.AggregateType). query := eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, user.AggregateType, project.AggregateType).
AggregateIDs(wm.UserID, wm.ProjectID). AggregateIDs(wm.UserID, wm.ProjectID).
EventTypes(user.HumanAddedType, EventTypes(user.UserV1AddedType,
user.HumanAddedType,
user.UserV1RegisteredType,
user.HumanRegisteredType, user.HumanRegisteredType,
user.MachineAddedEventType, user.MachineAddedEventType,
user.UserRemovedType, user.UserRemovedType,

View File

@ -73,7 +73,10 @@ func (wm *HumanAddressWriteModel) Query() *eventstore.SearchQueryBuilder {
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, user.AggregateType). return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, user.AggregateType).
AggregateIDs(wm.AggregateID). AggregateIDs(wm.AggregateID).
ResourceOwner(wm.ResourceOwner). ResourceOwner(wm.ResourceOwner).
EventTypes(user.HumanAddedType, EventTypes(user.UserV1AddedType,
user.UserV1RegisteredType,
user.UserV1AddressChangedType,
user.HumanAddedType,
user.HumanRegisteredType, user.HumanRegisteredType,
user.HumanAddressChangedType, user.HumanAddressChangedType,
user.UserRemovedType) user.UserRemovedType)

View File

@ -2,9 +2,10 @@ package command
import ( import (
"context" "context"
"github.com/caos/zitadel/internal/eventstore"
"time" "time"
"github.com/caos/zitadel/internal/eventstore"
"github.com/caos/zitadel/internal/crypto" "github.com/caos/zitadel/internal/crypto"
"github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/domain"
"github.com/caos/zitadel/internal/repository/user" "github.com/caos/zitadel/internal/repository/user"
@ -66,12 +67,19 @@ func (wm *HumanEmailWriteModel) Reduce() error {
func (wm *HumanEmailWriteModel) Query() *eventstore.SearchQueryBuilder { func (wm *HumanEmailWriteModel) Query() *eventstore.SearchQueryBuilder {
query := eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, user.AggregateType). query := eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, user.AggregateType).
AggregateIDs(wm.AggregateID). AggregateIDs(wm.AggregateID).
EventTypes(user.HumanAddedType, EventTypes(user.UserV1AddedType,
user.HumanAddedType,
user.UserV1RegisteredType,
user.HumanRegisteredType, user.HumanRegisteredType,
user.UserV1InitialCodeAddedType,
user.HumanInitialCodeAddedType, user.HumanInitialCodeAddedType,
user.UserV1InitializedCheckSucceededType,
user.HumanInitializedCheckSucceededType, user.HumanInitializedCheckSucceededType,
user.UserV1EmailChangedType,
user.HumanEmailChangedType, user.HumanEmailChangedType,
user.UserV1EmailCodeAddedType,
user.HumanEmailCodeAddedType, user.HumanEmailCodeAddedType,
user.UserV1EmailVerifiedType,
user.HumanEmailVerifiedType, user.HumanEmailVerifiedType,
user.UserRemovedType) user.UserRemovedType)
if wm.ResourceOwner != "" { if wm.ResourceOwner != "" {

View File

@ -68,11 +68,17 @@ func (wm *HumanInitCodeWriteModel) Reduce() error {
func (wm *HumanInitCodeWriteModel) Query() *eventstore.SearchQueryBuilder { func (wm *HumanInitCodeWriteModel) Query() *eventstore.SearchQueryBuilder {
query := eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, user.AggregateType). query := eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, user.AggregateType).
AggregateIDs(wm.AggregateID). AggregateIDs(wm.AggregateID).
EventTypes(user.HumanAddedType, EventTypes(user.UserV1AddedType,
user.HumanAddedType,
user.UserV1RegisteredType,
user.HumanRegisteredType, user.HumanRegisteredType,
user.UserV1EmailChangedType,
user.HumanEmailChangedType, user.HumanEmailChangedType,
user.UserV1EmailVerifiedType,
user.HumanEmailVerifiedType, user.HumanEmailVerifiedType,
user.UserV1InitialCodeAddedType,
user.HumanInitialCodeAddedType, user.HumanInitialCodeAddedType,
user.UserV1InitializedCheckSucceededType,
user.HumanInitializedCheckSucceededType, user.HumanInitializedCheckSucceededType,
user.UserRemovedType) user.UserRemovedType)
if wm.ResourceOwner != "" { if wm.ResourceOwner != "" {

View File

@ -70,6 +70,8 @@ func (wm *HumanWriteModel) Reduce() error {
wm.reduceHumanPhoneChangedEvent(e) wm.reduceHumanPhoneChangedEvent(e)
case *user.HumanPhoneVerifiedEvent: case *user.HumanPhoneVerifiedEvent:
wm.reduceHumanPhoneVerifiedEvent() wm.reduceHumanPhoneVerifiedEvent()
case *user.HumanPhoneRemovedEvent:
wm.reduceHumanPhoneRemovedEvent()
case *user.HumanPasswordChangedEvent: case *user.HumanPasswordChangedEvent:
wm.reduceHumanPasswordChangedEvent(e) wm.reduceHumanPasswordChangedEvent(e)
case *user.UserLockedEvent: case *user.UserLockedEvent:
@ -109,12 +111,24 @@ func (wm *HumanWriteModel) Query() *eventstore.SearchQueryBuilder {
user.HumanEmailVerifiedType, user.HumanEmailVerifiedType,
user.HumanPhoneChangedType, user.HumanPhoneChangedType,
user.HumanPhoneVerifiedType, user.HumanPhoneVerifiedType,
user.HumanPhoneRemovedType,
user.HumanPasswordChangedType, user.HumanPasswordChangedType,
user.UserLockedType, user.UserLockedType,
user.UserUnlockedType, user.UserUnlockedType,
user.UserDeactivatedType, user.UserDeactivatedType,
user.UserReactivatedType, user.UserReactivatedType,
user.UserRemovedType) user.UserRemovedType,
user.UserV1AddedType,
user.UserV1RegisteredType,
user.UserV1InitialCodeAddedType,
user.UserV1InitializedCheckSucceededType,
user.UserV1ProfileChangedType,
user.UserV1EmailChangedType,
user.UserV1EmailVerifiedType,
user.UserV1PhoneChangedType,
user.UserV1PhoneVerifiedType,
user.UserV1PhoneRemovedType,
user.UserV1PasswordChangedType)
} }
func (wm *HumanWriteModel) reduceHumanAddedEvent(e *user.HumanAddedEvent) { func (wm *HumanWriteModel) reduceHumanAddedEvent(e *user.HumanAddedEvent) {
@ -196,6 +210,11 @@ func (wm *HumanWriteModel) reduceHumanPhoneVerifiedEvent() {
wm.IsPhoneVerified = true wm.IsPhoneVerified = true
} }
func (wm *HumanWriteModel) reduceHumanPhoneRemovedEvent() {
wm.Phone = ""
wm.IsPhoneVerified = false
}
func (wm *HumanWriteModel) reduceHumanAddressChangedEvent(e *user.HumanAddressChangedEvent) { func (wm *HumanWriteModel) reduceHumanAddressChangedEvent(e *user.HumanAddressChangedEvent) {
if e.Country != nil { if e.Country != nil {
wm.Country = *e.Country wm.Country = *e.Country

View File

@ -46,7 +46,10 @@ func (wm *HumanOTPWriteModel) Query() *eventstore.SearchQueryBuilder {
EventTypes(user.HumanMFAOTPAddedType, EventTypes(user.HumanMFAOTPAddedType,
user.HumanMFAOTPVerifiedType, user.HumanMFAOTPVerifiedType,
user.HumanMFAOTPRemovedType, user.HumanMFAOTPRemovedType,
user.UserRemovedType) user.UserRemovedType,
user.UserV1MFAOTPAddedType,
user.UserV1MFAOTPVerifiedType,
user.UserV1MFAOTPRemovedType)
if wm.ResourceOwner != "" { if wm.ResourceOwner != "" {
query.ResourceOwner(wm.ResourceOwner) query.ResourceOwner(wm.ResourceOwner)
} }

View File

@ -75,7 +75,14 @@ func (wm *HumanPasswordWriteModel) Query() *eventstore.SearchQueryBuilder {
user.HumanPasswordChangedType, user.HumanPasswordChangedType,
user.HumanPasswordCodeAddedType, user.HumanPasswordCodeAddedType,
user.HumanEmailVerifiedType, user.HumanEmailVerifiedType,
user.UserRemovedType) user.UserRemovedType,
user.UserV1AddedType,
user.UserV1RegisteredType,
user.UserV1InitialCodeAddedType,
user.UserV1InitializedCheckSucceededType,
user.UserV1PasswordChangedType,
user.UserV1PasswordCodeAddedType,
user.UserV1EmailVerifiedType)
if wm.ResourceOwner != "" { if wm.ResourceOwner != "" {
query.ResourceOwner(wm.ResourceOwner) query.ResourceOwner(wm.ResourceOwner)
} }

View File

@ -85,7 +85,15 @@ func (wm *HumanPhoneWriteModel) Query() *eventstore.SearchQueryBuilder {
user.HumanPhoneVerifiedType, user.HumanPhoneVerifiedType,
user.HumanPhoneCodeAddedType, user.HumanPhoneCodeAddedType,
user.HumanPhoneRemovedType, user.HumanPhoneRemovedType,
user.UserRemovedType) user.UserRemovedType,
user.UserV1AddedType,
user.UserV1RegisteredType,
user.UserV1InitialCodeAddedType,
user.UserV1InitializedCheckSucceededType,
user.UserV1PhoneCodeAddedType,
user.UserV1PhoneChangedType,
user.UserV1PhoneVerifiedType,
user.UserV1PhoneRemovedType)
} }
func (wm *HumanPhoneWriteModel) NewChangedEvent( func (wm *HumanPhoneWriteModel) NewChangedEvent(

View File

@ -84,7 +84,10 @@ func (wm *HumanProfileWriteModel) Query() *eventstore.SearchQueryBuilder {
EventTypes(user.HumanAddedType, EventTypes(user.HumanAddedType,
user.HumanRegisteredType, user.HumanRegisteredType,
user.HumanProfileChangedType, user.HumanProfileChangedType,
user.UserRemovedType) user.UserRemovedType,
user.UserV1AddedType,
user.UserV1RegisteredType,
user.UserV1ProfileChangedType)
} }
func (wm *HumanProfileWriteModel) NewChangedEvent( func (wm *HumanProfileWriteModel) NewChangedEvent(

View File

@ -80,7 +80,10 @@ func (wm *UserWriteModel) Query() *eventstore.SearchQueryBuilder {
user.UserUnlockedType, user.UserUnlockedType,
user.UserDeactivatedType, user.UserDeactivatedType,
user.UserReactivatedType, user.UserReactivatedType,
user.UserRemovedType) user.UserRemovedType,
user.UserV1AddedType,
user.UserV1RegisteredType,
user.UserV1InitializedCheckSucceededType)
if wm.ResourceOwner != "" { if wm.ResourceOwner != "" {
query.ResourceOwner(wm.ResourceOwner) query.ResourceOwner(wm.ResourceOwner)
} }

View File

@ -1,15 +1,5 @@
package user package user
import (
"context"
"github.com/caos/zitadel/internal/eventstore"
"time"
"github.com/caos/zitadel/internal/crypto"
"github.com/caos/zitadel/internal/domain"
"golang.org/x/text/language"
)
const ( const (
UserV1AddedType = userEventTypePrefix + "added" UserV1AddedType = userEventTypePrefix + "added"
UserV1RegisteredType = userEventTypePrefix + "selfregistered" UserV1RegisteredType = userEventTypePrefix + "selfregistered"
@ -57,440 +47,3 @@ const (
UserV1MFAOTPCheckSucceededType = userV1MFAOTPEventTypePrefix + "check.succeeded" UserV1MFAOTPCheckSucceededType = userV1MFAOTPEventTypePrefix + "check.succeeded"
UserV1MFAOTPCheckFailedType = userV1MFAOTPEventTypePrefix + "check.failed" UserV1MFAOTPCheckFailedType = userV1MFAOTPEventTypePrefix + "check.failed"
) )
func NewUserV1AddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
userName,
firstName,
lastName,
nickName,
displayName string,
preferredLanguage language.Tag,
gender domain.Gender,
emailAddress,
phoneNumber,
country,
locality,
postalCode,
region,
streetAddress string,
) *HumanAddedEvent {
return &HumanAddedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1AddedType,
),
UserName: userName,
FirstName: firstName,
LastName: lastName,
NickName: nickName,
DisplayName: displayName,
PreferredLanguage: preferredLanguage,
Gender: gender,
EmailAddress: emailAddress,
PhoneNumber: phoneNumber,
Country: country,
Locality: locality,
PostalCode: postalCode,
Region: region,
StreetAddress: streetAddress,
}
}
func NewUserV1RegisteredEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
userName,
firstName,
lastName,
nickName,
displayName string,
preferredLanguage language.Tag,
gender domain.Gender,
emailAddress,
phoneNumber,
country,
locality,
postalCode,
region,
streetAddress string,
) *HumanRegisteredEvent {
return &HumanRegisteredEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1RegisteredType,
),
UserName: userName,
FirstName: firstName,
LastName: lastName,
NickName: nickName,
DisplayName: displayName,
PreferredLanguage: preferredLanguage,
Gender: gender,
EmailAddress: emailAddress,
PhoneNumber: phoneNumber,
Country: country,
Locality: locality,
PostalCode: postalCode,
Region: region,
StreetAddress: streetAddress,
}
}
func NewUserV1InitialCodeAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
code *crypto.CryptoValue,
expiry time.Duration,
) *HumanInitialCodeAddedEvent {
return &HumanInitialCodeAddedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1InitialCodeAddedType,
),
Code: code,
Expiry: expiry,
}
}
func NewUserV1InitialCodeSentEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanInitialCodeSentEvent {
return &HumanInitialCodeSentEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1InitialCodeSentType,
),
}
}
func NewUserV1InitializedCheckSucceededEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanInitializedCheckSucceededEvent {
return &HumanInitializedCheckSucceededEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1InitializedCheckSucceededType,
),
}
}
func NewUserV1InitializedCheckFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanInitializedCheckFailedEvent {
return &HumanInitializedCheckFailedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1InitializedCheckFailedType,
),
}
}
func NewUserV1SignedOutEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanSignedOutEvent {
return &HumanSignedOutEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1SignedOutType,
),
}
}
func NewUserV1PasswordChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
secret *crypto.CryptoValue,
changeRequired bool,
) *HumanPasswordChangedEvent {
return &HumanPasswordChangedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PasswordChangedType,
),
Secret: secret,
ChangeRequired: changeRequired,
}
}
func NewUserV1PasswordCodeAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
code *crypto.CryptoValue,
expiry time.Duration,
notificationType domain.NotificationType,
) *HumanPasswordCodeAddedEvent {
return &HumanPasswordCodeAddedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PasswordCodeAddedType,
),
Code: code,
Expiry: expiry,
NotificationType: notificationType,
}
}
func NewUserV1PasswordCodeSentEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPasswordCodeSentEvent {
return &HumanPasswordCodeSentEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PasswordCodeSentType,
),
}
}
func NewUserV1PasswordCheckSucceededEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPasswordCheckSucceededEvent {
return &HumanPasswordCheckSucceededEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PasswordCheckSucceededType,
),
}
}
func NewUserV1PasswordCheckFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPasswordCheckFailedEvent {
return &HumanPasswordCheckFailedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PasswordCheckFailedType,
),
}
}
func NewUserV1EmailChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
emailAddress string,
) *HumanEmailChangedEvent {
return &HumanEmailChangedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1EmailChangedType,
),
EmailAddress: emailAddress,
}
}
func NewUserV1EmailVerifiedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanEmailVerifiedEvent {
return &HumanEmailVerifiedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1EmailVerifiedType,
),
}
}
func NewUserV1EmailVerificationFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanEmailVerificationFailedEvent {
return &HumanEmailVerificationFailedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1EmailVerificationFailedType,
),
}
}
func NewUserV1EmailCodeAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
code *crypto.CryptoValue,
expiry time.Duration,
) *HumanEmailCodeAddedEvent {
return &HumanEmailCodeAddedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1EmailCodeAddedType,
),
Code: code,
Expiry: expiry,
}
}
func NewUserV1EmailCodeSentEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanEmailCodeSentEvent {
return &HumanEmailCodeSentEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1EmailCodeSentType,
),
}
}
func NewUserV1PhoneChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
phone string,
) *HumanPhoneChangedEvent {
return &HumanPhoneChangedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PhoneChangedType,
),
PhoneNumber: phone,
}
}
func NewUserV1PhoneRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPhoneRemovedEvent {
return &HumanPhoneRemovedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PhoneRemovedType,
),
}
}
func NewUserV1PhoneVerifiedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPhoneVerifiedEvent {
return &HumanPhoneVerifiedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PhoneVerifiedType,
),
}
}
func NewUserV1PhoneVerificationFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPhoneVerificationFailedEvent {
return &HumanPhoneVerificationFailedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PhoneVerificationFailedType,
),
}
}
func NewUserV1PhoneCodeAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
code *crypto.CryptoValue,
expiry time.Duration,
) *HumanPhoneCodeAddedEvent {
return &HumanPhoneCodeAddedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PhoneCodeAddedType,
),
Code: code,
Expiry: expiry,
}
}
func NewUserV1PhoneCodeSentEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanPhoneCodeSentEvent {
return &HumanPhoneCodeSentEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1PhoneCodeSentType,
),
}
}
func NewUserV1ProfileChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
) *HumanProfileChangedEvent {
return &HumanProfileChangedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1ProfileChangedType,
),
}
}
func NewUserV1AddressChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
country,
locality,
postalCode,
region,
streetAddress string,
) *HumanAddressChangedEvent {
return &HumanAddressChangedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1AddressChangedType,
),
}
}
func NewUserV1MFAInitSkippedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanMFAInitSkippedEvent {
return &HumanMFAInitSkippedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1MFAInitSkippedType,
),
}
}
func NewUserV1MFAOTPAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
secret *crypto.CryptoValue,
) *HumanOTPAddedEvent {
return &HumanOTPAddedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1MFAOTPAddedType,
),
Secret: secret,
}
}
func NewUserV1MFAOTPVerifiedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanOTPVerifiedEvent {
return &HumanOTPVerifiedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1MFAOTPVerifiedType,
),
}
}
func NewUserV1MFAOTPRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanOTPRemovedEvent {
return &HumanOTPRemovedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1MFAOTPRemovedType,
),
}
}
func NewUserV1MFAOTPCheckSucceededEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanOTPCheckSucceededEvent {
return &HumanOTPCheckSucceededEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1MFAOTPCheckSucceededType,
),
}
}
func NewUserV1MFAOTPCheckFailedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *HumanOTPCheckFailedEvent {
return &HumanOTPCheckFailedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
aggregate,
UserV1MFAOTPCheckFailedType,
),
}
}