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