fix: new es fix (#1532)

* fix: handle ListMyProjectOrgsRequestToModel queries

* fix: sort orgs for admin org list by org name

* fix: features converters

* fix: remove last role from user grant

* fix: ensure limit

* fix: ensure limit

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2021-04-06 16:03:07 +02:00
committed by GitHub
parent efc90b382c
commit 08bfec6652
38 changed files with 325 additions and 79 deletions

View File

@@ -71,7 +71,10 @@ func (repo *ProjectRepo) ProjectByID(ctx context.Context, id string) (*proj_mode
}
func (repo *ProjectRepo) SearchProjects(ctx context.Context, request *proj_model.ProjectViewSearchRequest) (*proj_model.ProjectViewSearchResponse, error) {
request.EnsureLimit(repo.SearchLimit)
err := request.EnsureLimit(repo.SearchLimit)
if err != nil {
return nil, err
}
sequence, sequenceErr := repo.View.GetLatestProjectSequence()
logging.Log("EVENT-Edc56").OnError(sequenceErr).Warn("could not read latest project sequence")
@@ -138,7 +141,10 @@ func (repo *ProjectRepo) ProjectMemberByID(ctx context.Context, projectID, userI
}
func (repo *ProjectRepo) SearchProjectMembers(ctx context.Context, request *proj_model.ProjectMemberSearchRequest) (*proj_model.ProjectMemberSearchResponse, error) {
request.EnsureLimit(repo.SearchLimit)
err := request.EnsureLimit(repo.SearchLimit)
if err != nil {
return nil, err
}
sequence, sequenceErr := repo.View.GetLatestProjectMemberSequence()
logging.Log("EVENT-3dgt6").OnError(sequenceErr).Warn("could not read latest project member sequence")
members, count, err := repo.View.SearchProjectMembers(request)
@@ -159,7 +165,10 @@ func (repo *ProjectRepo) SearchProjectMembers(ctx context.Context, request *proj
}
func (repo *ProjectRepo) SearchProjectRoles(ctx context.Context, projectID string, request *proj_model.ProjectRoleSearchRequest) (*proj_model.ProjectRoleSearchResponse, error) {
request.EnsureLimit(repo.SearchLimit)
err := request.EnsureLimit(repo.SearchLimit)
if err != nil {
return nil, err
}
request.AppendProjectQuery(projectID)
sequence, sequenceErr := repo.View.GetLatestProjectRoleSequence()
logging.Log("LSp0d-47suf").OnError(sequenceErr).Warn("could not read latest project role sequence")
@@ -235,7 +244,10 @@ func (repo *ProjectRepo) ApplicationByID(ctx context.Context, projectID, appID s
}
func (repo *ProjectRepo) SearchApplications(ctx context.Context, request *proj_model.ApplicationSearchRequest) (*proj_model.ApplicationSearchResponse, error) {
request.EnsureLimit(repo.SearchLimit)
err := request.EnsureLimit(repo.SearchLimit)
if err != nil {
return nil, err
}
sequence, sequenceErr := repo.View.GetLatestApplicationSequence()
logging.Log("EVENT-SKe8s").OnError(sequenceErr).Warn("could not read latest application sequence")
apps, count, err := repo.View.SearchApplications(request)
@@ -276,7 +288,10 @@ func (repo *ProjectRepo) ApplicationChanges(ctx context.Context, projectID strin
}
func (repo *ProjectRepo) SearchClientKeys(ctx context.Context, request *key_model.AuthNKeySearchRequest) (*key_model.AuthNKeySearchResponse, error) {
request.EnsureLimit(repo.SearchLimit)
err := request.EnsureLimit(repo.SearchLimit)
if err != nil {
return nil, err
}
sequence, sequenceErr := repo.View.GetLatestAuthNKeySequence()
logging.Log("EVENT-ADwgw").OnError(sequenceErr).Warn("could not read latest authn key sequence")
keys, count, err := repo.View.SearchAuthNKeys(request)
@@ -342,7 +357,10 @@ func (repo *ProjectRepo) ProjectGrantsByProjectIDAndRoleKey(ctx context.Context,
}
func (repo *ProjectRepo) SearchProjectGrants(ctx context.Context, request *proj_model.ProjectGrantViewSearchRequest) (*proj_model.ProjectGrantViewSearchResponse, error) {
request.EnsureLimit(repo.SearchLimit)
err := request.EnsureLimit(repo.SearchLimit)
if err != nil {
return nil, err
}
sequence, sequenceErr := repo.View.GetLatestProjectGrantSequence()
logging.Log("EVENT-Skw9f").OnError(sequenceErr).Warn("could not read latest project grant sequence")
projects, count, err := repo.View.SearchProjectGrants(request)
@@ -363,7 +381,10 @@ func (repo *ProjectRepo) SearchProjectGrants(ctx context.Context, request *proj_
}
func (repo *ProjectRepo) SearchGrantedProjects(ctx context.Context, request *proj_model.ProjectGrantViewSearchRequest) (*proj_model.ProjectGrantViewSearchResponse, error) {
request.EnsureLimit(repo.SearchLimit)
err := request.EnsureLimit(repo.SearchLimit)
if err != nil {
return nil, err
}
sequence, sequenceErr := repo.View.GetLatestProjectGrantSequence()
logging.Log("EVENT-Skw9f").OnError(sequenceErr).Warn("could not read latest project grant sequence")
@@ -422,7 +443,10 @@ func (repo *ProjectRepo) ProjectGrantMemberByID(ctx context.Context, projectID,
}
func (repo *ProjectRepo) SearchProjectGrantMembers(ctx context.Context, request *proj_model.ProjectGrantMemberSearchRequest) (*proj_model.ProjectGrantMemberSearchResponse, error) {
request.EnsureLimit(repo.SearchLimit)
err := request.EnsureLimit(repo.SearchLimit)
if err != nil {
return nil, err
}
sequence, sequenceErr := repo.View.GetLatestProjectGrantMemberSequence()
logging.Log("EVENT-Du8sk").OnError(sequenceErr).Warn("could not read latest project grant sequence")
members, count, err := repo.View.SearchProjectGrantMembers(request)