feat(changes): add editor (#273)

* fix(changes): add editor to change mapper

* fix(eventstore): only add latest sequence if greater 0 to query

* sort order in request for changes

* fix(changes): map editor for org, app and project
This commit is contained in:
Silvan
2020-06-25 11:25:38 +02:00
committed by GitHub
parent 62b654ea18
commit d947bb1247
27 changed files with 13484 additions and 14053 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ func (s *Server) RegenerateOIDCClientSecret(ctx context.Context, in *Application
}
func (s *Server) ApplicationChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
response, err := s.project.ApplicationChanges(ctx, changesRequest.Id, changesRequest.SecId, 0, 0)
response, err := s.project.ApplicationChanges(ctx, changesRequest.Id, changesRequest.SecId, changesRequest.SequenceOffset, changesRequest.Limit, changesRequest.Asc)
if err != nil {
return nil, err
}
@@ -337,6 +337,7 @@ func appChangesToMgtAPI(changes *proj_model.ApplicationChanges) (_ []*Change) {
ChangeDate: change.ChangeDate,
EventType: change.EventType,
Sequence: change.Sequence,
Editor: change.Modifier,
Data: data,
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+30 -60
View File
@@ -481,6 +481,13 @@
"required": false,
"type": "string",
"format": "uint64"
},
{
"name": "asc",
"in": "query",
"required": false,
"type": "boolean",
"format": "boolean"
}
],
"tags": [
@@ -1231,6 +1238,13 @@
"required": false,
"type": "string",
"format": "uint64"
},
{
"name": "asc",
"in": "query",
"required": false,
"type": "boolean",
"format": "boolean"
}
],
"tags": [
@@ -1276,6 +1290,13 @@
"required": false,
"type": "string",
"format": "uint64"
},
{
"name": "asc",
"in": "query",
"required": false,
"type": "boolean",
"format": "boolean"
}
],
"tags": [
@@ -2961,6 +2982,13 @@
"required": false,
"type": "string",
"format": "uint64"
},
{
"name": "asc",
"in": "query",
"required": false,
"type": "boolean",
"format": "boolean"
}
],
"tags": [
@@ -3520,7 +3548,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufStruct"
"type": "object"
}
}
},
@@ -3531,19 +3559,6 @@
}
},
"definitions": {
"protobufListValue": {
"type": "object",
"properties": {
"values": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufValue"
},
"description": "Repeated field of dynamically typed values."
}
},
"description": "`ListValue` is a wrapper around a repeated field of values.\n\nThe JSON representation for `ListValue` is JSON array."
},
"protobufNullValue": {
"type": "string",
"enum": [
@@ -3552,51 +3567,6 @@
"default": "NULL_VALUE",
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
},
"protobufStruct": {
"type": "object",
"properties": {
"fields": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/protobufValue"
},
"description": "Unordered map of dynamically typed values."
}
},
"description": "`Struct` represents a structured data value, consisting of fields\nwhich map to dynamically typed values. In some languages, `Struct`\nmight be supported by a native representation. For example, in\nscripting languages like JS a struct is represented as an\nobject. The details of that representation are described together\nwith the proto support for the language.\n\nThe JSON representation for `Struct` is JSON object."
},
"protobufValue": {
"type": "object",
"properties": {
"null_value": {
"$ref": "#/definitions/protobufNullValue",
"description": "Represents a null value."
},
"number_value": {
"type": "number",
"format": "double",
"description": "Represents a double value."
},
"string_value": {
"type": "string",
"description": "Represents a string value."
},
"bool_value": {
"type": "boolean",
"format": "boolean",
"description": "Represents a boolean value."
},
"struct_value": {
"$ref": "#/definitions/protobufStruct",
"description": "Represents a structured value."
},
"list_value": {
"$ref": "#/definitions/protobufListValue",
"description": "Represents a repeated `Value`."
}
},
"description": "`Value` represents a dynamically typed value which can be either\nnull, a number, a string, a boolean, a recursive struct value, or a\nlist of values. A producer of value is expected to set one of that\nvariants, absence of any variant indicates an error.\n\nThe JSON representation for `Value` is JSON value."
},
"v1AddOrgDomainRequest": {
"type": "object",
"properties": {
@@ -3796,7 +3766,7 @@
"type": "string"
},
"data": {
"$ref": "#/definitions/protobufStruct"
"type": "object"
}
}
},
+2 -1
View File
@@ -2,6 +2,7 @@ package grpc
import (
"context"
"github.com/caos/zitadel/internal/api/auth"
"github.com/golang/protobuf/ptypes/empty"
)
@@ -60,7 +61,7 @@ func (s *Server) RemoveMyOrgDomain(ctx context.Context, in *RemoveOrgDomainReque
}
func (s *Server) OrgChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
response, err := s.org.OrgChanges(ctx, changesRequest.Id, 0, 0)
response, err := s.org.OrgChanges(ctx, changesRequest.Id, changesRequest.SequenceOffset, changesRequest.Limit, changesRequest.Asc)
if err != nil {
return nil, err
}
+1
View File
@@ -174,6 +174,7 @@ func orgChangesToMgtAPI(changes *org_model.OrgChanges) (_ []*Change) {
EventType: change.EventType,
Sequence: change.Sequence,
Data: data,
Editor: change.Modifier,
}
}
+1 -1
View File
@@ -112,7 +112,7 @@ func (s *Server) SearchProjectRoles(ctx context.Context, in *ProjectRoleSearchRe
}
func (s *Server) ProjectChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
response, err := s.project.ProjectChanges(ctx, changesRequest.Id, 0, 0)
response, err := s.project.ProjectChanges(ctx, changesRequest.Id, changesRequest.SequenceOffset, changesRequest.Limit, changesRequest.Asc)
if err != nil {
return nil, err
}
@@ -289,6 +289,7 @@ func projectChangesToMgtAPI(changes *proj_model.ProjectChanges) (_ []*Change) {
ChangeDate: change.ChangeDate,
EventType: change.EventType,
Sequence: change.Sequence,
Editor: change.Modifier,
Data: data,
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ func (s *Server) SearchUsers(ctx context.Context, in *UserSearchRequest) (*UserS
}
func (s *Server) UserChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
response, err := s.user.UserChanges(ctx, changesRequest.Id, 0, 0)
response, err := s.user.UserChanges(ctx, changesRequest.Id, changesRequest.SequenceOffset, changesRequest.Limit, changesRequest.Asc)
if err != nil {
return nil, err
}
@@ -504,6 +504,7 @@ func userChangesToMgtAPI(changes *usr_model.UserChanges) (_ []*Change) {
EventType: change.EventType,
Sequence: change.Sequence,
Data: data,
Editor: change.Modifier,
}
}
@@ -1361,6 +1361,7 @@ message ChangeRequest {
string sec_id = 2;
uint64 limit= 3;
uint64 sequence_offset = 4;
bool asc = 5;
}
message Changes {