diff --git a/internal/api/grpc/admin/login_policy.go b/internal/api/grpc/admin/login_policy.go index 2232883c30..4a8c2cbd67 100644 --- a/internal/api/grpc/admin/login_policy.go +++ b/internal/api/grpc/admin/login_policy.go @@ -4,13 +4,12 @@ import ( "context" "github.com/zitadel/zitadel/internal/api/authz" - "github.com/zitadel/zitadel/internal/api/grpc/user" - "github.com/zitadel/zitadel/internal/query" - "github.com/zitadel/zitadel/internal/api/grpc/idp" "github.com/zitadel/zitadel/internal/api/grpc/object" policy_grpc "github.com/zitadel/zitadel/internal/api/grpc/policy" + "github.com/zitadel/zitadel/internal/api/grpc/user" "github.com/zitadel/zitadel/internal/domain" + "github.com/zitadel/zitadel/internal/query" admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin" ) @@ -63,10 +62,17 @@ func (s *Server) AddIDPToLoginPolicy(ctx context.Context, req *admin_pb.AddIDPTo func (s *Server) RemoveIDPFromLoginPolicy(ctx context.Context, req *admin_pb.RemoveIDPFromLoginPolicyRequest) (*admin_pb.RemoveIDPFromLoginPolicyResponse, error) { idpQuery, err := query.NewIDPUserLinkIDPIDSearchQuery(req.IdpId) + if err != nil { + return nil, err + } idps, err := s.query.IDPUserLinks(ctx, &query.IDPUserLinksSearchQuery{ Queries: []query.SearchQuery{idpQuery}, }) + if err != nil { + return nil, err + } + objectDetails, err := s.command.RemoveIDPProviderFromDefaultLoginPolicy(ctx, &domain.IDPProvider{IDPConfigID: req.IdpId}, user.ExternalIDPViewsToExternalIDPs(idps.Links)...) if err != nil { return nil, err diff --git a/internal/api/grpc/admin/org.go b/internal/api/grpc/admin/org.go index 8e85e3e032..f3a1ef7818 100644 --- a/internal/api/grpc/admin/org.go +++ b/internal/api/grpc/admin/org.go @@ -3,8 +3,6 @@ package admin import ( "context" - "google.golang.org/protobuf/types/known/timestamppb" - "github.com/zitadel/zitadel/internal/api/authz" "github.com/zitadel/zitadel/internal/api/grpc/object" org_grpc "github.com/zitadel/zitadel/internal/api/grpc/org" @@ -12,7 +10,6 @@ import ( "github.com/zitadel/zitadel/internal/domain" "github.com/zitadel/zitadel/internal/query" admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin" - obj_pb "github.com/zitadel/zitadel/pkg/grpc/object" ) func (s *Server) IsOrgUnique(ctx context.Context, req *admin_pb.IsOrgUniqueRequest) (*admin_pb.IsOrgUniqueResponse, error) { @@ -38,12 +35,8 @@ func (s *Server) ListOrgs(ctx context.Context, req *admin_pb.ListOrgsRequest) (* return nil, err } return &admin_pb.ListOrgsResponse{ - Result: org_grpc.OrgViewsToPb(orgs.Orgs), - Details: &obj_pb.ListDetails{ - TotalResult: orgs.Count, - ProcessedSequence: orgs.Sequence, - ViewTimestamp: timestamppb.New(orgs.Timestamp), - }, + Result: org_grpc.OrgViewsToPb(orgs.Orgs), + Details: object.ToListDetails(orgs.Count, orgs.Sequence, orgs.Timestamp), }, nil } diff --git a/internal/api/grpc/auth/idp.go b/internal/api/grpc/auth/idp.go index 250ac13780..780a2f60dc 100644 --- a/internal/api/grpc/auth/idp.go +++ b/internal/api/grpc/auth/idp.go @@ -18,12 +18,8 @@ func (s *Server) ListMyLinkedIDPs(ctx context.Context, req *auth_pb.ListMyLinked return nil, err } return &auth_pb.ListMyLinkedIDPsResponse{ - Result: idp_grpc.IDPUserLinksToPb(links.Links), - Details: object.ToListDetails( - links.Count, - links.Sequence, - links.Timestamp, - ), + Result: idp_grpc.IDPUserLinksToPb(links.Links), + Details: object.ToListDetails(links.Count, links.Sequence, links.Timestamp), }, nil } diff --git a/internal/api/grpc/auth/permission.go b/internal/api/grpc/auth/permission.go index e32f7ef108..89249fc3f6 100644 --- a/internal/api/grpc/auth/permission.go +++ b/internal/api/grpc/auth/permission.go @@ -4,7 +4,7 @@ import ( "context" "github.com/zitadel/zitadel/internal/api/authz" - obj_grpc "github.com/zitadel/zitadel/internal/api/grpc/object" + "github.com/zitadel/zitadel/internal/api/grpc/object" user_grpc "github.com/zitadel/zitadel/internal/api/grpc/user" "github.com/zitadel/zitadel/internal/query" auth_pb "github.com/zitadel/zitadel/pkg/grpc/auth" @@ -53,11 +53,7 @@ func (s *Server) ListMyMemberships(ctx context.Context, req *auth_pb.ListMyMembe return nil, err } return &auth_pb.ListMyMembershipsResponse{ - Result: user_grpc.MembershipsToMembershipsPb(response.Memberships), - Details: obj_grpc.ToListDetails( - response.Count, - response.Sequence, - response.Timestamp, - ), + Result: user_grpc.MembershipsToMembershipsPb(response.Memberships), + Details: object.ToListDetails(response.Count, response.Sequence, response.Timestamp), }, nil } diff --git a/internal/api/grpc/auth/refresh_token.go b/internal/api/grpc/auth/refresh_token.go index 234c71354d..00d398c973 100644 --- a/internal/api/grpc/auth/refresh_token.go +++ b/internal/api/grpc/auth/refresh_token.go @@ -16,12 +16,8 @@ func (s *Server) ListMyRefreshTokens(ctx context.Context, req *auth.ListMyRefres return nil, err } return &auth.ListMyRefreshTokensResponse{ - Result: user_grpc.RefreshTokensToPb(res.Result), - Details: object.ToListDetails( - res.TotalResult, - res.Sequence, - res.Timestamp, - ), + Result: user_grpc.RefreshTokensToPb(res.Result), + Details: object.ToListDetails(res.TotalResult, res.Sequence, res.Timestamp), }, nil } diff --git a/internal/api/grpc/auth/user.go b/internal/api/grpc/auth/user.go index 66fdb657a8..ba10eb209a 100644 --- a/internal/api/grpc/auth/user.go +++ b/internal/api/grpc/auth/user.go @@ -75,12 +75,8 @@ func (s *Server) ListMyMetadata(ctx context.Context, req *auth_pb.ListMyMetadata return nil, err } return &auth_pb.ListMyMetadataResponse{ - Result: metadata.MetadataListToPb(res.Metadata), - Details: obj_grpc.ToListDetails( - res.Count, - res.Sequence, - res.Timestamp, - ), + Result: metadata.MetadataListToPb(res.Metadata), + Details: obj_grpc.ToListDetails(res.Count, res.Sequence, res.Timestamp), }, nil } @@ -133,12 +129,8 @@ func (s *Server) ListMyUserGrants(ctx context.Context, req *auth_pb.ListMyUserGr return nil, err } return &auth_pb.ListMyUserGrantsResponse{ - Result: UserGrantsToPb(res.UserGrants), - Details: obj_grpc.ToListDetails( - res.Count, - res.Sequence, - res.Timestamp, - ), + Result: UserGrantsToPb(res.UserGrants), + Details: obj_grpc.ToListDetails(res.Count, res.Sequence, res.Timestamp), }, nil } diff --git a/internal/api/grpc/management/org.go b/internal/api/grpc/management/org.go index d475c38f05..8e045a0049 100644 --- a/internal/api/grpc/management/org.go +++ b/internal/api/grpc/management/org.go @@ -134,12 +134,8 @@ func (s *Server) ListOrgDomains(ctx context.Context, req *mgmt_pb.ListOrgDomains return nil, err } return &mgmt_pb.ListOrgDomainsResponse{ - Result: org_grpc.DomainsToPb(domains.Domains), - Details: object.ToListDetails( - domains.Count, - domains.Sequence, - domains.Timestamp, - ), + Result: org_grpc.DomainsToPb(domains.Domains), + Details: object.ToListDetails(domains.Count, domains.Sequence, domains.Timestamp), }, nil } @@ -233,12 +229,8 @@ func (s *Server) ListOrgMembers(ctx context.Context, req *mgmt_pb.ListOrgMembers return nil, err } return &mgmt_pb.ListOrgMembersResponse{ - Result: member_grpc.MembersToPb(s.assetAPIPrefix(ctx), members.Members), - Details: object.ToListDetails( - members.Count, - members.Sequence, - members.Timestamp, - ), + Result: member_grpc.MembersToPb(s.assetAPIPrefix(ctx), members.Members), + Details: object.ToListDetails(members.Count, members.Sequence, members.Timestamp), }, nil } diff --git a/internal/api/grpc/management/policy_login.go b/internal/api/grpc/management/policy_login.go index aaf38d38d2..f26d6c255d 100644 --- a/internal/api/grpc/management/policy_login.go +++ b/internal/api/grpc/management/policy_login.go @@ -10,7 +10,6 @@ import ( "github.com/zitadel/zitadel/internal/api/grpc/user" "github.com/zitadel/zitadel/internal/domain" "github.com/zitadel/zitadel/internal/query" - mgmt_pb "github.com/zitadel/zitadel/pkg/grpc/management" ) diff --git a/internal/api/grpc/management/project.go b/internal/api/grpc/management/project.go index cefcb68f50..35d564cb83 100644 --- a/internal/api/grpc/management/project.go +++ b/internal/api/grpc/management/project.go @@ -50,12 +50,8 @@ func (s *Server) ListProjects(ctx context.Context, req *mgmt_pb.ListProjectsRequ return nil, err } return &mgmt_pb.ListProjectsResponse{ - Result: project_grpc.ProjectViewsToPb(projects.Projects), - Details: object_grpc.ToListDetails( - projects.Count, - projects.Sequence, - projects.Timestamp, - ), + Result: project_grpc.ProjectViewsToPb(projects.Projects), + Details: object_grpc.ToListDetails(projects.Count, projects.Sequence, projects.Timestamp), }, nil } @@ -77,12 +73,8 @@ func (s *Server) ListGrantedProjects(ctx context.Context, req *mgmt_pb.ListGrant return nil, err } return &mgmt_pb.ListGrantedProjectsResponse{ - Result: project_grpc.GrantedProjectViewsToPb(projects.ProjectGrants), - Details: object_grpc.ToListDetails( - projects.Count, - projects.Sequence, - projects.Timestamp, - ), + Result: project_grpc.GrantedProjectViewsToPb(projects.ProjectGrants), + Details: object_grpc.ToListDetails(projects.Count, projects.Sequence, projects.Timestamp), }, nil } @@ -100,12 +92,8 @@ func (s *Server) ListGrantedProjectRoles(ctx context.Context, req *mgmt_pb.ListG return nil, err } return &mgmt_pb.ListGrantedProjectRolesResponse{ - Result: project_grpc.RoleViewsToPb(roles.ProjectRoles), - Details: object_grpc.ToListDetails( - roles.Count, - roles.Sequence, - roles.Timestamp, - ), + Result: project_grpc.RoleViewsToPb(roles.ProjectRoles), + Details: object_grpc.ToListDetails(roles.Count, roles.Sequence, roles.Timestamp), }, nil } @@ -127,12 +115,8 @@ func (s *Server) AddProject(ctx context.Context, req *mgmt_pb.AddProjectRequest) return nil, err } return &mgmt_pb.AddProjectResponse{ - Id: project.AggregateID, - Details: object_grpc.AddToDetailsPb( - project.Sequence, - project.ChangeDate, - project.ResourceOwner, - ), + Id: project.AggregateID, + Details: object_grpc.AddToDetailsPb(project.Sequence, project.ChangeDate, project.ResourceOwner), }, nil } @@ -208,12 +192,8 @@ func (s *Server) ListProjectRoles(ctx context.Context, req *mgmt_pb.ListProjectR return nil, err } return &mgmt_pb.ListProjectRolesResponse{ - Result: project_grpc.RoleViewsToPb(roles.ProjectRoles), - Details: object_grpc.ToListDetails( - roles.Count, - roles.Sequence, - roles.Timestamp, - ), + Result: project_grpc.RoleViewsToPb(roles.ProjectRoles), + Details: object_grpc.ToListDetails(roles.Count, roles.Sequence, roles.Timestamp), }, nil } @@ -302,12 +282,8 @@ func (s *Server) ListProjectMembers(ctx context.Context, req *mgmt_pb.ListProjec return nil, err } return &mgmt_pb.ListProjectMembersResponse{ - Result: member_grpc.MembersToPb(s.assetAPIPrefix(ctx), members.Members), - Details: object_grpc.ToListDetails( - members.Count, - members.Sequence, - members.Timestamp, - ), + Result: member_grpc.MembersToPb(s.assetAPIPrefix(ctx), members.Members), + Details: object_grpc.ToListDetails(members.Count, members.Sequence, members.Timestamp), }, nil } @@ -317,11 +293,7 @@ func (s *Server) AddProjectMember(ctx context.Context, req *mgmt_pb.AddProjectMe return nil, err } return &mgmt_pb.AddProjectMemberResponse{ - Details: object_grpc.AddToDetailsPb( - member.Sequence, - member.ChangeDate, - member.ResourceOwner, - ), + Details: object_grpc.AddToDetailsPb(member.Sequence, member.ChangeDate, member.ResourceOwner), }, nil } diff --git a/internal/api/grpc/management/project_application.go b/internal/api/grpc/management/project_application.go index 1a21e47d64..5261024b43 100644 --- a/internal/api/grpc/management/project_application.go +++ b/internal/api/grpc/management/project_application.go @@ -33,12 +33,8 @@ func (s *Server) ListApps(ctx context.Context, req *mgmt_pb.ListAppsRequest) (*m return nil, err } return &mgmt_pb.ListAppsResponse{ - Result: project_grpc.AppsToPb(apps.Apps), - Details: object_grpc.ToListDetails( - apps.Count, - apps.Sequence, - apps.Timestamp, - ), + Result: project_grpc.AppsToPb(apps.Apps), + Details: object_grpc.ToListDetails(apps.Count, apps.Sequence, apps.Timestamp), }, nil } @@ -227,12 +223,8 @@ func (s *Server) ListAppKeys(ctx context.Context, req *mgmt_pb.ListAppKeysReques return nil, err } return &mgmt_pb.ListAppKeysResponse{ - Result: authn_grpc.KeysToPb(keys.AuthNKeys), - Details: object_grpc.ToListDetails( - keys.Count, - keys.Sequence, - keys.Timestamp, - ), + Result: authn_grpc.KeysToPb(keys.AuthNKeys), + Details: object_grpc.ToListDetails(keys.Count, keys.Sequence, keys.Timestamp), }, nil } diff --git a/internal/api/grpc/management/project_grant.go b/internal/api/grpc/management/project_grant.go index 6ca939039d..54b978e244 100644 --- a/internal/api/grpc/management/project_grant.go +++ b/internal/api/grpc/management/project_grant.go @@ -36,12 +36,8 @@ func (s *Server) ListProjectGrants(ctx context.Context, req *mgmt_pb.ListProject return nil, err } return &mgmt_pb.ListProjectGrantsResponse{ - Result: proj_grpc.GrantedProjectViewsToPb(grants.ProjectGrants), - Details: object_grpc.ToListDetails( - grants.Count, - grants.Sequence, - grants.Timestamp, - ), + Result: proj_grpc.GrantedProjectViewsToPb(grants.ProjectGrants), + Details: object_grpc.ToListDetails(grants.Count, grants.Sequence, grants.Timestamp), }, nil } @@ -63,12 +59,8 @@ func (s *Server) ListAllProjectGrants(ctx context.Context, req *mgmt_pb.ListAllP return nil, err } return &mgmt_pb.ListAllProjectGrantsResponse{ - Result: proj_grpc.GrantedProjectViewsToPb(grants.ProjectGrants), - Details: object_grpc.ToListDetails( - grants.Count, - grants.Sequence, - grants.Timestamp, - ), + Result: proj_grpc.GrantedProjectViewsToPb(grants.ProjectGrants), + Details: object_grpc.ToListDetails(grants.Count, grants.Sequence, grants.Timestamp), }, nil } @@ -177,12 +169,8 @@ func (s *Server) ListProjectGrantMembers(ctx context.Context, req *mgmt_pb.ListP return nil, err } return &mgmt_pb.ListProjectGrantMembersResponse{ - Result: member_grpc.MembersToPb(s.assetAPIPrefix(ctx), response.Members), - Details: object_grpc.ToListDetails( - response.Count, - response.Sequence, - response.Timestamp, - ), + Result: member_grpc.MembersToPb(s.assetAPIPrefix(ctx), response.Members), + Details: object_grpc.ToListDetails(response.Count, response.Sequence, response.Timestamp), }, nil } diff --git a/internal/api/grpc/management/user.go b/internal/api/grpc/management/user.go index 74cfcb5303..f7cc3fe669 100644 --- a/internal/api/grpc/management/user.go +++ b/internal/api/grpc/management/user.go @@ -68,12 +68,8 @@ func (s *Server) ListUsers(ctx context.Context, req *mgmt_pb.ListUsersRequest) ( return nil, err } return &mgmt_pb.ListUsersResponse{ - Result: user_grpc.UsersToPb(res.Users, s.assetAPIPrefix(ctx)), - Details: obj_grpc.ToListDetails( - res.Count, - res.Sequence, - res.Timestamp, - ), + Result: user_grpc.UsersToPb(res.Users, s.assetAPIPrefix(ctx)), + Details: obj_grpc.ToListDetails(res.Count, res.Sequence, res.Timestamp), }, nil } @@ -120,12 +116,8 @@ func (s *Server) ListUserMetadata(ctx context.Context, req *mgmt_pb.ListUserMeta return nil, err } return &mgmt_pb.ListUserMetadataResponse{ - Result: metadata.MetadataListToPb(res.Metadata), - Details: obj_grpc.ToListDetails( - res.Count, - res.Sequence, - res.Timestamp, - ), + Result: metadata.MetadataListToPb(res.Metadata), + Details: obj_grpc.ToListDetails(res.Count, res.Sequence, res.Timestamp), }, nil } @@ -731,12 +723,8 @@ func (s *Server) ListMachineKeys(ctx context.Context, req *mgmt_pb.ListMachineKe return nil, err } return &mgmt_pb.ListMachineKeysResponse{ - Result: authn.KeysToPb(result.AuthNKeys), - Details: obj_grpc.ToListDetails( - result.Count, - result.Sequence, - result.Timestamp, - ), + Result: authn.KeysToPb(result.AuthNKeys), + Details: obj_grpc.ToListDetails(result.Count, result.Sequence, result.Timestamp), }, nil } @@ -798,12 +786,8 @@ func (s *Server) ListPersonalAccessTokens(ctx context.Context, req *mgmt_pb.List return nil, err } return &mgmt_pb.ListPersonalAccessTokensResponse{ - Result: user_grpc.PersonalAccessTokensToPb(result.PersonalAccessTokens), - Details: obj_grpc.ToListDetails( - result.Count, - result.Sequence, - result.Timestamp, - ), + Result: user_grpc.PersonalAccessTokensToPb(result.PersonalAccessTokens), + Details: obj_grpc.ToListDetails(result.Count, result.Sequence, result.Timestamp), }, nil } @@ -848,12 +832,8 @@ func (s *Server) ListHumanLinkedIDPs(ctx context.Context, req *mgmt_pb.ListHuman return nil, err } return &mgmt_pb.ListHumanLinkedIDPsResponse{ - Result: idp_grpc.IDPUserLinksToPb(res.Links), - Details: obj_grpc.ToListDetails( - res.Count, - res.Sequence, - res.Timestamp, - ), + Result: idp_grpc.IDPUserLinksToPb(res.Links), + Details: obj_grpc.ToListDetails(res.Count, res.Sequence, res.Timestamp), }, nil } func (s *Server) RemoveHumanLinkedIDP(ctx context.Context, req *mgmt_pb.RemoveHumanLinkedIDPRequest) (*mgmt_pb.RemoveHumanLinkedIDPResponse, error) { @@ -876,11 +856,7 @@ func (s *Server) ListUserMemberships(ctx context.Context, req *mgmt_pb.ListUserM return nil, err } return &mgmt_pb.ListUserMembershipsResponse{ - Result: user_grpc.MembershipsToMembershipsPb(response.Memberships), - Details: obj_grpc.ToListDetails( - response.Count, - response.Sequence, - response.Timestamp, - ), + Result: user_grpc.MembershipsToMembershipsPb(response.Memberships), + Details: obj_grpc.ToListDetails(response.Count, response.Sequence, response.Timestamp), }, nil } diff --git a/internal/api/grpc/management/user_grant.go b/internal/api/grpc/management/user_grant.go index 68ab81da84..2de3e4b6d1 100644 --- a/internal/api/grpc/management/user_grant.go +++ b/internal/api/grpc/management/user_grant.go @@ -38,12 +38,8 @@ func (s *Server) ListUserGrants(ctx context.Context, req *mgmt_pb.ListUserGrantR return nil, err } return &mgmt_pb.ListUserGrantResponse{ - Result: user.UserGrantsToPb(s.assetAPIPrefix(ctx), res.UserGrants), - Details: obj_grpc.ToListDetails( - res.Count, - res.Sequence, - res.Timestamp, - ), + Result: user.UserGrantsToPb(s.assetAPIPrefix(ctx), res.UserGrants), + Details: obj_grpc.ToListDetails(res.Count, res.Sequence, res.Timestamp), }, nil } diff --git a/internal/api/grpc/object/converter.go b/internal/api/grpc/object/converter.go index 7590aee0b6..38dc81da2f 100644 --- a/internal/api/grpc/object/converter.go +++ b/internal/api/grpc/object/converter.go @@ -69,11 +69,15 @@ func ToListDetails( processedSequence uint64, viewTimestamp time.Time, ) *object_pb.ListDetails { - return &object_pb.ListDetails{ + details := &object_pb.ListDetails{ TotalResult: totalResult, ProcessedSequence: processedSequence, - ViewTimestamp: timestamppb.New(viewTimestamp), } + if !viewTimestamp.IsZero() { + details.ViewTimestamp = timestamppb.New(viewTimestamp) + } + + return details } func TextMethodToModel(method object_pb.TextQueryMethod) domain.SearchMethod { diff --git a/internal/api/grpc/system/instance.go b/internal/api/grpc/system/instance.go index 6cb9afb981..1cc032001e 100644 --- a/internal/api/grpc/system/instance.go +++ b/internal/api/grpc/system/instance.go @@ -47,17 +47,15 @@ func (s *Server) AddInstance(ctx context.Context, req *system_pb.AddInstanceRequ } return &system_pb.AddInstanceResponse{ InstanceId: id, - Details: object.AddToDetailsPb( - details.Sequence, - details.EventDate, - details.ResourceOwner, - ), + Details: object.AddToDetailsPb(details.Sequence, details.EventDate, details.ResourceOwner), }, nil - return nil, nil } func (s *Server) ExistsDomain(ctx context.Context, req *system_pb.ExistsDomainRequest) (*system_pb.ExistsDomainResponse, error) { domainQuery, err := query.NewInstanceDomainDomainSearchQuery(query.TextEqualsIgnoreCase, req.Domain) + if err != nil { + return nil, err + } query := &query.InstanceDomainSearchQueries{ SearchRequest: query.SearchRequest{ @@ -90,12 +88,8 @@ func (s *Server) ListDomains(ctx context.Context, req *system_pb.ListDomainsRequ return nil, err } return &system_pb.ListDomainsResponse{ - Result: instance_grpc.DomainsToPb(domains.Domains), - Details: object.ToListDetails( - domains.Count, - domains.Sequence, - domains.Timestamp, - ), + Result: instance_grpc.DomainsToPb(domains.Domains), + Details: object.ToListDetails(domains.Count, domains.Sequence, domains.Timestamp), }, nil } @@ -111,11 +105,7 @@ func (s *Server) AddDomain(ctx context.Context, req *system_pb.AddDomainRequest) return nil, err } return &system_pb.AddDomainResponse{ - Details: object.AddToDetailsPb( - details.Sequence, - details.EventDate, - details.ResourceOwner, - ), + Details: object.AddToDetailsPb(details.Sequence, details.EventDate, details.ResourceOwner), }, nil } @@ -126,11 +116,7 @@ func (s *Server) RemoveDomain(ctx context.Context, req *system_pb.RemoveDomainRe return nil, err } return &system_pb.RemoveDomainResponse{ - Details: object.ChangeToDetailsPb( - details.Sequence, - details.EventDate, - details.ResourceOwner, - ), + Details: object.ChangeToDetailsPb(details.Sequence, details.EventDate, details.ResourceOwner), }, nil } @@ -141,10 +127,6 @@ func (s *Server) SetPrimaryDomain(ctx context.Context, req *system_pb.SetPrimary return nil, err } return &system_pb.SetPrimaryDomainResponse{ - Details: object.ChangeToDetailsPb( - details.Sequence, - details.EventDate, - details.ResourceOwner, - ), + Details: object.ChangeToDetailsPb(details.Sequence, details.EventDate, details.ResourceOwner), }, nil } diff --git a/internal/query/current_sequence.go b/internal/query/current_sequence.go index 198887e1cb..940dd93cc9 100644 --- a/internal/query/current_sequence.go +++ b/internal/query/current_sequence.go @@ -201,10 +201,7 @@ func prepareLatestSequence() (sq.SelectBuilder, func(*sql.Row) (*LatestSequence, &seq.Sequence, &seq.Timestamp, ) - if err != nil { - if errs.Is(err, sql.ErrNoRows) { - return nil, errors.ThrowNotFound(err, "QUERY-gmd9o", "Errors.CurrentSequence.NotFound") - } + if err != nil && !errs.Is(err, sql.ErrNoRows) { return nil, errors.ThrowInternal(err, "QUERY-aAZ1D", "Errors.Internal") } return seq, nil