mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:47:33 +00:00
feat: sequence and timestamp on searchrequests (#468)
* feat: reread events * feat: sequence and timestamo on search requests * feat: sequence and timestamo on search requests * fix: better naming * fix: log errors * fix: read sequence before search request
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/caos/logging"
|
||||
view_model "github.com/caos/zitadel/internal/view/model"
|
||||
"github.com/caos/zitadel/pkg/grpc/admin"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
)
|
||||
|
||||
func viewsFromModel(views []*view_model.View) []*admin.View {
|
||||
@@ -24,10 +26,14 @@ func failedEventsFromModel(failedEvents []*view_model.FailedEvent) []*admin.Fail
|
||||
}
|
||||
|
||||
func viewFromModel(view *view_model.View) *admin.View {
|
||||
timestamp, err := ptypes.TimestampProto(view.CurrentTimestamp)
|
||||
logging.Log("GRPC-KSo03").OnError(err).Debug("unable to parse timestamp")
|
||||
|
||||
return &admin.View{
|
||||
Database: view.Database,
|
||||
ViewName: view.ViewName,
|
||||
Sequence: view.CurrentSequence,
|
||||
Database: view.Database,
|
||||
ViewName: view.ViewName,
|
||||
ProcessedSequence: view.CurrentSequence,
|
||||
ViewTimestamp: timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -103,11 +103,15 @@ func iamMemberSearchMethodToModel(key admin.SearchMethod) model.SearchMethod {
|
||||
}
|
||||
|
||||
func iamMemberSearchResponseFromModel(resp *iam_model.IamMemberSearchResponse) *admin.IamMemberSearchResponse {
|
||||
timestamp, err := ptypes.TimestampProto(resp.Timestamp)
|
||||
logging.Log("GRPC-5shu8").OnError(err).Debug("date parse failed")
|
||||
return &admin.IamMemberSearchResponse{
|
||||
Limit: resp.Limit,
|
||||
Offset: resp.Offset,
|
||||
TotalResult: resp.TotalResult,
|
||||
Result: iamMembersFromView(resp.Result),
|
||||
Limit: resp.Limit,
|
||||
Offset: resp.Offset,
|
||||
TotalResult: resp.TotalResult,
|
||||
Result: iamMembersFromView(resp.Result),
|
||||
ProcessedSequence: resp.Sequence,
|
||||
ViewTimestamp: timestamp,
|
||||
}
|
||||
}
|
||||
func iamMembersFromView(viewMembers []*iam_model.IamMemberView) []*admin.IamMemberView {
|
||||
|
@@ -21,12 +21,7 @@ func (s *Server) SearchOrgs(ctx context.Context, request *admin.OrgSearchRequest
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &admin.OrgSearchResponse{
|
||||
Result: orgViewsFromModel(result.Result),
|
||||
Limit: request.Limit,
|
||||
Offset: request.Offset,
|
||||
TotalResult: result.TotalResult,
|
||||
}, nil
|
||||
return orgSearchResponseFromModel(result), nil
|
||||
}
|
||||
|
||||
func (s *Server) IsOrgUnique(ctx context.Context, request *admin.UniqueOrgRequest) (org *admin.UniqueOrgResponse, err error) {
|
||||
|
@@ -72,6 +72,19 @@ func setUpOrgResponseFromModel(setUp *admin_model.SetupOrg) *admin.OrgSetUpRespo
|
||||
}
|
||||
}
|
||||
|
||||
func orgSearchResponseFromModel(request *org_model.OrgSearchResult) *admin.OrgSearchResponse {
|
||||
timestamp, err := ptypes.TimestampProto(request.Timestamp)
|
||||
logging.Log("GRPC-shu7s").OnError(err).Debug("unable to get timestamp from time")
|
||||
return &admin.OrgSearchResponse{
|
||||
Result: orgViewsFromModel(request.Result),
|
||||
Limit: request.Limit,
|
||||
Offset: request.Offset,
|
||||
TotalResult: request.TotalResult,
|
||||
ProcessedSequence: request.Sequence,
|
||||
ViewTimestamp: timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
func orgViewsFromModel(orgs []*org_model.OrgView) []*admin.Org {
|
||||
result := make([]*admin.Org, len(orgs))
|
||||
for i, org := range orgs {
|
||||
|
Reference in New Issue
Block a user