mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:37:34 +00:00
fixup! fixup! fix(org): adding unique constrants to not allow an org to be added twice with same id
This commit is contained in:
@@ -52,7 +52,6 @@ func NewRemoveOrgNameUniqueConstraint(orgName string) *eventstore.UniqueConstrai
|
||||
type OrgAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ func (e *OrgAddedEvent) Payload() interface{} {
|
||||
}
|
||||
|
||||
func (e *OrgAddedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return []*eventstore.UniqueConstraint{NewAddOrgIDUniqueConstraint(e.ID), NewAddOrgNameUniqueConstraint(e.Name)}
|
||||
return []*eventstore.UniqueConstraint{NewAddOrgIDUniqueConstraint(e.Aggregate().ID), NewAddOrgNameUniqueConstraint(e.Name)}
|
||||
}
|
||||
|
||||
func (e *OrgAddedEvent) Fields() []*eventstore.FieldOperation {
|
||||
@@ -108,7 +107,6 @@ func NewOrgAddedEvent(ctx context.Context, aggregate *eventstore.Aggregate, name
|
||||
aggregate,
|
||||
OrgAddedEventType,
|
||||
),
|
||||
ID: aggregate.ID,
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
@@ -291,7 +289,6 @@ func OrgReactivatedEventMapper(event eventstore.Event) (eventstore.Event, error)
|
||||
|
||||
type OrgRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
id string
|
||||
name string
|
||||
usernames []string
|
||||
loginMustBeDomain bool
|
||||
@@ -306,7 +303,7 @@ func (e *OrgRemovedEvent) Payload() interface{} {
|
||||
|
||||
func (e *OrgRemovedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
constraints := []*eventstore.UniqueConstraint{
|
||||
NewRemoveOrgIDUniqueConstraint(e.id),
|
||||
NewRemoveOrgIDUniqueConstraint(e.Aggregate().ID),
|
||||
NewRemoveOrgNameUniqueConstraint(e.name),
|
||||
}
|
||||
for _, name := range e.usernames {
|
||||
@@ -338,7 +335,6 @@ func NewOrgRemovedEvent(ctx context.Context, aggregate *eventstore.Aggregate, na
|
||||
aggregate,
|
||||
OrgRemovedEventType,
|
||||
),
|
||||
id: aggregate.ID,
|
||||
name: name,
|
||||
usernames: usernames,
|
||||
domains: domains,
|
||||
|
Reference in New Issue
Block a user