mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-10 20:43:40 +00:00
fix: clean up writemodels user v3
This commit is contained in:
parent
4efe7d1786
commit
f7b6dafe81
@ -8,8 +8,8 @@ func init() {
|
|||||||
eventstore.RegisterFilterEventMapper(AggregateType, PasswordCreatedType, eventstore.GenericEventMapper[PasswordCreatedEvent])
|
eventstore.RegisterFilterEventMapper(AggregateType, PasswordCreatedType, eventstore.GenericEventMapper[PasswordCreatedEvent])
|
||||||
eventstore.RegisterFilterEventMapper(AggregateType, PasswordCodeAddedType, eventstore.GenericEventMapper[PasswordCodeAddedEvent])
|
eventstore.RegisterFilterEventMapper(AggregateType, PasswordCodeAddedType, eventstore.GenericEventMapper[PasswordCodeAddedEvent])
|
||||||
eventstore.RegisterFilterEventMapper(AggregateType, PasswordDeletedType, eventstore.GenericEventMapper[PasswordDeletedEvent])
|
eventstore.RegisterFilterEventMapper(AggregateType, PasswordDeletedType, eventstore.GenericEventMapper[PasswordDeletedEvent])
|
||||||
eventstore.RegisterFilterEventMapper(AggregateType, JWTCreatedType, eventstore.GenericEventMapper[JWTCreatedEvent])
|
eventstore.RegisterFilterEventMapper(AggregateType, PublicKeyCreatedType, eventstore.GenericEventMapper[PublicKeyCreatedEvent])
|
||||||
eventstore.RegisterFilterEventMapper(AggregateType, JWTDeletedType, eventstore.GenericEventMapper[JWTDeletedEvent])
|
eventstore.RegisterFilterEventMapper(AggregateType, PublicKeyDeletedType, eventstore.GenericEventMapper[PublicKeyDeletedEvent])
|
||||||
eventstore.RegisterFilterEventMapper(AggregateType, PATCreatedType, eventstore.GenericEventMapper[PATCreatedEvent])
|
eventstore.RegisterFilterEventMapper(AggregateType, PATCreatedType, eventstore.GenericEventMapper[PATCreatedEvent])
|
||||||
eventstore.RegisterFilterEventMapper(AggregateType, PATDeletedType, eventstore.GenericEventMapper[PATDeletedEvent])
|
eventstore.RegisterFilterEventMapper(AggregateType, PATDeletedType, eventstore.GenericEventMapper[PATDeletedEvent])
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
jwtPrefix = eventPrefix + "jwt."
|
publicKeyPrefix = eventPrefix + "pk."
|
||||||
JWTCreatedType = jwtPrefix + "created"
|
PublicKeyCreatedType = publicKeyPrefix + "created"
|
||||||
JWTDeletedType = jwtPrefix + "deleted"
|
PublicKeyDeletedType = publicKeyPrefix + "deleted"
|
||||||
)
|
)
|
||||||
|
|
||||||
type JWTCreatedEvent struct {
|
type PublicKeyCreatedEvent struct {
|
||||||
*eventstore.BaseEvent `json:"-"`
|
*eventstore.BaseEvent `json:"-"`
|
||||||
|
|
||||||
UserID string `json:"userID"`
|
UserID string `json:"userID"`
|
||||||
@ -24,34 +24,34 @@ type JWTCreatedEvent struct {
|
|||||||
TriggeredAtOrigin string `json:"triggerOrigin,omitempty"`
|
TriggeredAtOrigin string `json:"triggerOrigin,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *JWTCreatedEvent) SetBaseEvent(event *eventstore.BaseEvent) {
|
func (e *PublicKeyCreatedEvent) SetBaseEvent(event *eventstore.BaseEvent) {
|
||||||
e.BaseEvent = event
|
e.BaseEvent = event
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *JWTCreatedEvent) Payload() interface{} {
|
func (e *PublicKeyCreatedEvent) Payload() interface{} {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *JWTCreatedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
func (e *PublicKeyCreatedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *JWTCreatedEvent) TriggerOrigin() string {
|
func (e *PublicKeyCreatedEvent) TriggerOrigin() string {
|
||||||
return e.TriggeredAtOrigin
|
return e.TriggeredAtOrigin
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewJWTCreatedEvent(
|
func NewPublicKeyCreatedEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
aggregate *eventstore.Aggregate,
|
aggregate *eventstore.Aggregate,
|
||||||
userID string,
|
userID string,
|
||||||
expirationDate time.Time,
|
expirationDate time.Time,
|
||||||
publicKey []byte,
|
publicKey []byte,
|
||||||
) *JWTCreatedEvent {
|
) *PublicKeyCreatedEvent {
|
||||||
return &JWTCreatedEvent{
|
return &PublicKeyCreatedEvent{
|
||||||
BaseEvent: eventstore.NewBaseEventForPush(
|
BaseEvent: eventstore.NewBaseEventForPush(
|
||||||
ctx,
|
ctx,
|
||||||
aggregate,
|
aggregate,
|
||||||
JWTCreatedType,
|
PublicKeyCreatedType,
|
||||||
),
|
),
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
ExpirationDate: expirationDate,
|
ExpirationDate: expirationDate,
|
||||||
@ -60,31 +60,31 @@ func NewJWTCreatedEvent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type JWTDeletedEvent struct {
|
type PublicKeyDeletedEvent struct {
|
||||||
*eventstore.BaseEvent `json:"-"`
|
*eventstore.BaseEvent `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *JWTDeletedEvent) SetBaseEvent(event *eventstore.BaseEvent) {
|
func (e *PublicKeyDeletedEvent) SetBaseEvent(event *eventstore.BaseEvent) {
|
||||||
e.BaseEvent = event
|
e.BaseEvent = event
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *JWTDeletedEvent) Payload() interface{} {
|
func (e *PublicKeyDeletedEvent) Payload() interface{} {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *JWTDeletedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
func (e *PublicKeyDeletedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewJWTDeletedEvent(
|
func NewPublicKeyDeletedEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
aggregate *eventstore.Aggregate,
|
aggregate *eventstore.Aggregate,
|
||||||
) *JWTDeletedEvent {
|
) *PublicKeyDeletedEvent {
|
||||||
return &JWTDeletedEvent{
|
return &PublicKeyDeletedEvent{
|
||||||
BaseEvent: eventstore.NewBaseEventForPush(
|
BaseEvent: eventstore.NewBaseEventForPush(
|
||||||
ctx,
|
ctx,
|
||||||
aggregate,
|
aggregate,
|
||||||
JWTDeletedType,
|
PublicKeyDeletedType,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user