mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +00:00
fix: unique constraints on instance domain events (#3635)
This commit is contained in:
@@ -9,6 +9,8 @@ type EventUniqueConstraint struct {
|
||||
Action UniqueConstraintAction
|
||||
//ErrorMessage defines the translation file key for the error message
|
||||
ErrorMessage string
|
||||
//IsGlobal defines if the unique constraint is globally unique or just within a single instance
|
||||
IsGlobal bool
|
||||
}
|
||||
|
||||
type UniqueConstraintAction int32
|
||||
@@ -39,3 +41,27 @@ func NewRemoveEventUniqueConstraint(
|
||||
Action: UniqueConstraintRemove,
|
||||
}
|
||||
}
|
||||
|
||||
func NewAddGlobalEventUniqueConstraint(
|
||||
uniqueType,
|
||||
uniqueField,
|
||||
errMessage string) *EventUniqueConstraint {
|
||||
return &EventUniqueConstraint{
|
||||
UniqueType: uniqueType,
|
||||
UniqueField: uniqueField,
|
||||
ErrorMessage: errMessage,
|
||||
IsGlobal: true,
|
||||
Action: UniqueConstraintAdd,
|
||||
}
|
||||
}
|
||||
|
||||
func NewRemoveGlobalEventUniqueConstraint(
|
||||
uniqueType,
|
||||
uniqueField string) *EventUniqueConstraint {
|
||||
return &EventUniqueConstraint{
|
||||
UniqueType: uniqueType,
|
||||
UniqueField: uniqueField,
|
||||
IsGlobal: true,
|
||||
Action: UniqueConstraintRemove,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user