mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:57:32 +00:00
fix: all enums same style (#262)
* fix: all enums same style * fix: rename process to reduce * add some missing enum renaming Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -177,22 +177,22 @@ func TestAppendAppStateEvent(t *testing.T) {
|
||||
{
|
||||
name: "append deactivate application event",
|
||||
args: args{
|
||||
project: &Project{Applications: []*Application{&Application{AppID: "AppID", Name: "Application", State: int32(model.APPSTATE_ACTIVE)}}},
|
||||
project: &Project{Applications: []*Application{&Application{AppID: "AppID", Name: "Application", State: int32(model.AppStateActive)}}},
|
||||
app: &ApplicationID{AppID: "AppID"},
|
||||
event: &es_models.Event{},
|
||||
state: model.APPSTATE_INACTIVE,
|
||||
state: model.AppStateInactive,
|
||||
},
|
||||
result: &Project{Applications: []*Application{&Application{AppID: "AppID", Name: "Application", State: int32(model.APPSTATE_INACTIVE)}}},
|
||||
result: &Project{Applications: []*Application{&Application{AppID: "AppID", Name: "Application", State: int32(model.AppStateInactive)}}},
|
||||
},
|
||||
{
|
||||
name: "append reactivate application event",
|
||||
args: args{
|
||||
project: &Project{Applications: []*Application{&Application{AppID: "AppID", Name: "Application", State: int32(model.APPSTATE_INACTIVE)}}},
|
||||
project: &Project{Applications: []*Application{&Application{AppID: "AppID", Name: "Application", State: int32(model.AppStateInactive)}}},
|
||||
app: &ApplicationID{AppID: "AppID"},
|
||||
event: &es_models.Event{},
|
||||
state: model.APPSTATE_ACTIVE,
|
||||
state: model.AppStateActive,
|
||||
},
|
||||
result: &Project{Applications: []*Application{&Application{AppID: "AppID", Name: "Application", State: int32(model.APPSTATE_ACTIVE)}}},
|
||||
result: &Project{Applications: []*Application{&Application{AppID: "AppID", Name: "Application", State: int32(model.AppStateActive)}}},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
@@ -100,7 +100,7 @@ func (p *Project) appendAddOIDCConfigEvent(event *es_models.Event) error {
|
||||
}
|
||||
config.ObjectRoot.CreationDate = event.CreationDate
|
||||
if i, a := GetApplication(p.Applications, config.AppID); a != nil {
|
||||
p.Applications[i].Type = int32(model.APPTYPE_OIDC)
|
||||
p.Applications[i].Type = int32(model.AppTypeOIDC)
|
||||
p.Applications[i].OIDCConfig = config
|
||||
}
|
||||
return nil
|
||||
|
@@ -118,9 +118,9 @@ func (p *Project) AppendEvent(event *es_models.Event) error {
|
||||
case ApplicationRemoved:
|
||||
return p.appendRemoveAppEvent(event)
|
||||
case ApplicationDeactivated:
|
||||
return p.appendAppStateEvent(event, model.APPSTATE_INACTIVE)
|
||||
return p.appendAppStateEvent(event, model.AppStateInactive)
|
||||
case ApplicationReactivated:
|
||||
return p.appendAppStateEvent(event, model.APPSTATE_ACTIVE)
|
||||
return p.appendAppStateEvent(event, model.AppStateActive)
|
||||
case OIDCConfigAdded:
|
||||
return p.appendAddOIDCConfigEvent(event)
|
||||
case OIDCConfigChanged, OIDCConfigSecretChanged:
|
||||
@@ -130,9 +130,9 @@ func (p *Project) AppendEvent(event *es_models.Event) error {
|
||||
case ProjectGrantChanged, ProjectGrantCascadeChanged:
|
||||
return p.appendChangeGrantEvent(event)
|
||||
case ProjectGrantDeactivated:
|
||||
return p.appendGrantStateEvent(event, model.PROJECTGRANTSTATE_INACTIVE)
|
||||
return p.appendGrantStateEvent(event, model.ProjectGrantStateInactive)
|
||||
case ProjectGrantReactivated:
|
||||
return p.appendGrantStateEvent(event, model.PROJECTGRANTSTATE_ACTIVE)
|
||||
return p.appendGrantStateEvent(event, model.ProjectGrantStateActive)
|
||||
case ProjectGrantRemoved:
|
||||
return p.appendRemoveGrantEvent(event)
|
||||
case ProjectGrantMemberAdded:
|
||||
@@ -147,22 +147,22 @@ func (p *Project) AppendEvent(event *es_models.Event) error {
|
||||
|
||||
func (p *Project) AppendAddProjectEvent(event *es_models.Event) error {
|
||||
p.setData(event)
|
||||
p.State = int32(model.PROJECTSTATE_ACTIVE)
|
||||
p.State = int32(model.ProjectStateActive)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Project) appendDeactivatedEvent() error {
|
||||
p.State = int32(model.PROJECTSTATE_INACTIVE)
|
||||
p.State = int32(model.ProjectStateInactive)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Project) appendReactivatedEvent() error {
|
||||
p.State = int32(model.PROJECTSTATE_ACTIVE)
|
||||
p.State = int32(model.ProjectStateActive)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Project) appendRemovedEvent() error {
|
||||
p.State = int32(model.PROJECTSTATE_REMOVED)
|
||||
p.State = int32(model.ProjectStateRemoved)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -136,9 +136,9 @@ func TestAppendGrantStateEvent(t *testing.T) {
|
||||
project: &Project{Grants: []*ProjectGrant{&ProjectGrant{GrantID: "GrantID", GrantedOrgID: "OrgID", RoleKeys: []string{"Key"}}}},
|
||||
grant: &ProjectGrantID{GrantID: "GrantID"},
|
||||
event: &es_models.Event{},
|
||||
state: model.PROJECTGRANTSTATE_INACTIVE,
|
||||
state: model.ProjectGrantStateInactive,
|
||||
},
|
||||
result: &Project{Grants: []*ProjectGrant{&ProjectGrant{GrantID: "GrantID", GrantedOrgID: "OrgID", RoleKeys: []string{"Key"}, State: int32(model.PROJECTGRANTSTATE_INACTIVE)}}},
|
||||
result: &Project{Grants: []*ProjectGrant{&ProjectGrant{GrantID: "GrantID", GrantedOrgID: "OrgID", RoleKeys: []string{"Key"}, State: int32(model.ProjectGrantStateInactive)}}},
|
||||
},
|
||||
{
|
||||
name: "append reactivate grant event",
|
||||
@@ -146,9 +146,9 @@ func TestAppendGrantStateEvent(t *testing.T) {
|
||||
project: &Project{Grants: []*ProjectGrant{&ProjectGrant{GrantID: "GrantID", GrantedOrgID: "OrgID", RoleKeys: []string{"Key"}}}},
|
||||
grant: &ProjectGrantID{GrantID: "GrantID"},
|
||||
event: &es_models.Event{},
|
||||
state: model.PROJECTGRANTSTATE_ACTIVE,
|
||||
state: model.ProjectGrantStateActive,
|
||||
},
|
||||
result: &Project{Grants: []*ProjectGrant{&ProjectGrant{GrantID: "GrantID", GrantedOrgID: "OrgID", RoleKeys: []string{"Key"}, State: int32(model.PROJECTGRANTSTATE_ACTIVE)}}},
|
||||
result: &Project{Grants: []*ProjectGrant{&ProjectGrant{GrantID: "GrantID", GrantedOrgID: "OrgID", RoleKeys: []string{"Key"}, State: int32(model.ProjectGrantStateActive)}}},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
@@ -69,7 +69,7 @@ func TestProjectFromEvents(t *testing.T) {
|
||||
},
|
||||
project: &Project{Name: "ProjectName"},
|
||||
},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.PROJECTSTATE_ACTIVE), Name: "ProjectName"},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.ProjectStateActive), Name: "ProjectName"},
|
||||
},
|
||||
{
|
||||
name: "project from events, nil project",
|
||||
@@ -79,7 +79,7 @@ func TestProjectFromEvents(t *testing.T) {
|
||||
},
|
||||
project: nil,
|
||||
},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.PROJECTSTATE_ACTIVE)},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.ProjectStateActive)},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -112,7 +112,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
event: &es_models.Event{AggregateID: "AggregateID", Sequence: 1, Type: ProjectAdded},
|
||||
project: &Project{Name: "ProjectName"},
|
||||
},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.PROJECTSTATE_ACTIVE), Name: "ProjectName"},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.ProjectStateActive), Name: "ProjectName"},
|
||||
},
|
||||
{
|
||||
name: "append change event",
|
||||
@@ -120,21 +120,21 @@ func TestAppendEvent(t *testing.T) {
|
||||
event: &es_models.Event{AggregateID: "AggregateID", Sequence: 1, Type: ProjectChanged},
|
||||
project: &Project{Name: "ProjectName"},
|
||||
},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.PROJECTSTATE_ACTIVE), Name: "ProjectName"},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.ProjectStateActive), Name: "ProjectName"},
|
||||
},
|
||||
{
|
||||
name: "append deactivate event",
|
||||
args: args{
|
||||
event: &es_models.Event{AggregateID: "AggregateID", Sequence: 1, Type: ProjectDeactivated},
|
||||
},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.PROJECTSTATE_INACTIVE)},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.ProjectStateInactive)},
|
||||
},
|
||||
{
|
||||
name: "append reactivate event",
|
||||
args: args{
|
||||
event: &es_models.Event{AggregateID: "AggregateID", Sequence: 1, Type: ProjectReactivated},
|
||||
},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.PROJECTSTATE_ACTIVE)},
|
||||
result: &Project{ObjectRoot: es_models.ObjectRoot{AggregateID: "AggregateID"}, State: int32(model.ProjectStateActive)},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -172,7 +172,7 @@ func TestAppendDeactivatedEvent(t *testing.T) {
|
||||
args: args{
|
||||
project: &Project{},
|
||||
},
|
||||
result: &Project{State: int32(model.PROJECTSTATE_INACTIVE)},
|
||||
result: &Project{State: int32(model.ProjectStateInactive)},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -199,7 +199,7 @@ func TestAppendReactivatedEvent(t *testing.T) {
|
||||
args: args{
|
||||
project: &Project{},
|
||||
},
|
||||
result: &Project{State: int32(model.PROJECTSTATE_ACTIVE)},
|
||||
result: &Project{State: int32(model.ProjectStateActive)},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
Reference in New Issue
Block a user