Merge branch 'main' into clean-transactional-propsal

This commit is contained in:
adlerhurst
2025-07-25 18:16:20 +02:00
987 changed files with 106221 additions and 36435 deletions

View File

@@ -1,6 +1,8 @@
package org
import (
"context"
"github.com/zitadel/zitadel/internal/eventstore"
)
@@ -27,3 +29,7 @@ func NewAggregate(id string) *Aggregate {
},
}
}
func AggregateFromWriteModel(ctx context.Context, wm *eventstore.WriteModel) *eventstore.Aggregate {
return eventstore.AggregateFromWriteModelCtx(ctx, wm, AggregateType, AggregateVersion)
}

View File

@@ -114,4 +114,5 @@ func init() {
eventstore.RegisterFilterEventMapper(AggregateType, NotificationPolicyAddedEventType, NotificationPolicyAddedEventMapper)
eventstore.RegisterFilterEventMapper(AggregateType, NotificationPolicyChangedEventType, NotificationPolicyChangedEventMapper)
eventstore.RegisterFilterEventMapper(AggregateType, NotificationPolicyRemovedEventType, NotificationPolicyRemovedEventMapper)
eventstore.RegisterFilterEventMapper(AggregateType, HostedLoginTranslationSet, HostedLoginTranslationSetEventMapper)
}

View File

@@ -0,0 +1,55 @@
package org
import (
"context"
"golang.org/x/text/language"
"github.com/zitadel/zitadel/internal/eventstore"
"github.com/zitadel/zitadel/internal/zerrors"
)
const (
HostedLoginTranslationSet = orgEventTypePrefix + "hosted_login_translation.set"
)
type HostedLoginTranslationSetEvent struct {
eventstore.BaseEvent `json:"-"`
Translation map[string]any `json:"translation,omitempty"`
Language language.Tag `json:"language,omitempty"`
Level string `json:"level,omitempty"`
}
func NewHostedLoginTranslationSetEvent(ctx context.Context, aggregate *eventstore.Aggregate, translation map[string]any, language language.Tag) *HostedLoginTranslationSetEvent {
return &HostedLoginTranslationSetEvent{
BaseEvent: *eventstore.NewBaseEventForPush(ctx, aggregate, HostedLoginTranslationSet),
Translation: translation,
Language: language,
Level: string(aggregate.Type),
}
}
func (e *HostedLoginTranslationSetEvent) Payload() any {
return e
}
func (e *HostedLoginTranslationSetEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
return nil
}
func (e *HostedLoginTranslationSetEvent) Fields() []*eventstore.FieldOperation {
return nil
}
func HostedLoginTranslationSetEventMapper(event eventstore.Event) (eventstore.Event, error) {
translationSet := &HostedLoginTranslationSetEvent{
BaseEvent: *eventstore.BaseEventFromRepo(event),
}
err := event.Unmarshal(translationSet)
if err != nil {
return nil, zerrors.ThrowInternal(err, "ORG-BH82Eb", "unable to unmarshal hosted login translation set event")
}
return translationSet, nil
}