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:
Fabi
2020-06-23 14:47:47 +02:00
committed by GitHub
parent c376b92315
commit 3cd3a238c2
152 changed files with 1026 additions and 1024 deletions

View File

@@ -72,12 +72,12 @@ func (g *UserGrant) AppendEvent(event *es_models.Event) error {
UserGrantCascadeChanged:
return g.setData(event)
case UserGrantDeactivated:
g.appendGrantStateEvent(model.USERGRANTSTATE_INACTIVE)
g.appendGrantStateEvent(model.UserGrantStateInactive)
case UserGrantReactivated:
g.appendGrantStateEvent(model.USERGRANTSTATE_ACTIVE)
g.appendGrantStateEvent(model.UserGrantStateActive)
case UserGrantRemoved,
UserGrantCascadeRemoved:
g.appendGrantStateEvent(model.USERGRANTSTATE_REMOVED)
g.appendGrantStateEvent(model.UserGrantStateRemoved)
}
return nil
}

View File

@@ -24,9 +24,9 @@ func TestAppendGrantStateEvent(t *testing.T) {
existing: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}},
grant: &UserGrantID{GrantID: "GrantID"},
event: &es_models.Event{},
state: model.USERGRANTSTATE_INACTIVE,
state: model.UserGrantStateInactive,
},
result: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}, State: int32(model.USERGRANTSTATE_INACTIVE)},
result: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}, State: int32(model.UserGrantStateInactive)},
},
{
name: "append reactivate grant event",
@@ -34,9 +34,9 @@ func TestAppendGrantStateEvent(t *testing.T) {
existing: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}},
grant: &UserGrantID{GrantID: "GrantID"},
event: &es_models.Event{},
state: model.USERGRANTSTATE_ACTIVE,
state: model.UserGrantStateActive,
},
result: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}, State: int32(model.USERGRANTSTATE_ACTIVE)},
result: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}, State: int32(model.UserGrantStateActive)},
},
{
name: "append remove grant event",
@@ -44,9 +44,9 @@ func TestAppendGrantStateEvent(t *testing.T) {
existing: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}},
grant: &UserGrantID{GrantID: "GrantID"},
event: &es_models.Event{},
state: model.USERGRANTSTATE_REMOVED,
state: model.UserGrantStateRemoved,
},
result: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}, State: int32(model.USERGRANTSTATE_REMOVED)},
result: &UserGrant{ObjectRoot: es_models.ObjectRoot{AggregateID: "ID"}, UserID: "UserID", ProjectID: "ProjectID", RoleKeys: []string{"Key"}, State: int32(model.UserGrantStateRemoved)},
},
}
for _, tt := range tests {