mirror of
https://github.com/andwati/zitadel.git
synced 2026-12-04 18:08:50 +00:00
feat: uniqueness (#1190)
* feat: uniqueness on events * fix: some tests * fix: add unique username * fix: nice error message * fix: add unique test * fix: add unique test * fix: add unique constraint to events * fix: correct unique constraint on user events * fix: remove user constraint * fix: add unique constraints * fix: add unique constraints * fix: add unique constraints * fix: unnique constraints without interface * fix: unique idp config * fix: unique constraint comments * fix: unique constraints in one table * fix: unique constraints error * fix: fix unique constraint on create user * fix: fix unique constraint on create project * fix: fix unique constraint on idp configs
This commit is contained in:
@@ -23,6 +23,10 @@ func (e *ProjectSetEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *ProjectSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewIAMProjectSetEvent(ctx context.Context, projectID string) *ProjectSetEvent {
|
||||
return &ProjectSetEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
|
||||
@@ -23,6 +23,10 @@ func (e *GlobalOrgSetEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *GlobalOrgSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewGlobalOrgSetEventEvent(ctx context.Context, orgID string) *GlobalOrgSetEvent {
|
||||
return &GlobalOrgSetEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
|
||||
@@ -26,6 +26,10 @@ func (e *SetupStepEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *SetupStepEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetupStepMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
step := &SetupStepEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
|
||||
@@ -23,7 +23,7 @@ type IDPConfigAddedEvent struct {
|
||||
|
||||
func NewIDPConfigAddedEvent(
|
||||
ctx context.Context,
|
||||
configID string,
|
||||
configID,
|
||||
name string,
|
||||
configType domain.IDPConfigType,
|
||||
stylingType domain.IDPConfigStylingType,
|
||||
@@ -31,9 +31,10 @@ func NewIDPConfigAddedEvent(
|
||||
|
||||
return &IDPConfigAddedEvent{
|
||||
IDPConfigAddedEvent: *idpconfig.NewIDPConfigAddedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
eventstore.NewBaseEventForPushWithResourceOwner(
|
||||
ctx,
|
||||
IDPConfigAddedEventType,
|
||||
domain.IAMID,
|
||||
),
|
||||
configID,
|
||||
name,
|
||||
@@ -87,16 +88,19 @@ type IDPConfigRemovedEvent struct {
|
||||
|
||||
func NewIDPConfigRemovedEvent(
|
||||
ctx context.Context,
|
||||
configID string,
|
||||
resourceOwner,
|
||||
configID,
|
||||
name string,
|
||||
) *IDPConfigRemovedEvent {
|
||||
|
||||
return &IDPConfigRemovedEvent{
|
||||
IDPConfigRemovedEvent: *idpconfig.NewIDPConfigRemovedEvent(
|
||||
eventstore.NewBaseEventForPush(
|
||||
eventstore.NewBaseEventForPushWithResourceOwner(
|
||||
ctx,
|
||||
IDPConfigRemovedEventType,
|
||||
resourceOwner,
|
||||
),
|
||||
configID,
|
||||
name,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user