mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-08 14:47:40 +00:00
fix: allow sorting of MyProjectOrgs (by name) (#7970)
This commit is contained in:
parent
9e91b53bd4
commit
b924fd59a5
@ -5,7 +5,6 @@ import (
|
|||||||
org_grpc "github.com/zitadel/zitadel/internal/api/grpc/org"
|
org_grpc "github.com/zitadel/zitadel/internal/api/grpc/org"
|
||||||
"github.com/zitadel/zitadel/internal/query"
|
"github.com/zitadel/zitadel/internal/query"
|
||||||
"github.com/zitadel/zitadel/pkg/grpc/admin"
|
"github.com/zitadel/zitadel/pkg/grpc/admin"
|
||||||
"github.com/zitadel/zitadel/pkg/grpc/org"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func listOrgRequestToModel(req *admin.ListOrgsRequest) (*query.OrgSearchQueries, error) {
|
func listOrgRequestToModel(req *admin.ListOrgsRequest) (*query.OrgSearchQueries, error) {
|
||||||
@ -18,18 +17,9 @@ func listOrgRequestToModel(req *admin.ListOrgsRequest) (*query.OrgSearchQueries,
|
|||||||
SearchRequest: query.SearchRequest{
|
SearchRequest: query.SearchRequest{
|
||||||
Offset: offset,
|
Offset: offset,
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
SortingColumn: fieldNameToOrgColumn(req.SortingColumn),
|
SortingColumn: org_grpc.FieldNameToOrgColumn(req.SortingColumn),
|
||||||
Asc: asc,
|
Asc: asc,
|
||||||
},
|
},
|
||||||
Queries: queries,
|
Queries: queries,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldNameToOrgColumn(fieldName org.OrgFieldName) query.Column {
|
|
||||||
switch fieldName {
|
|
||||||
case org.OrgFieldName_ORG_FIELD_NAME_NAME:
|
|
||||||
return query.OrgColumnName
|
|
||||||
default:
|
|
||||||
return query.Column{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -266,9 +266,10 @@ func ListMyProjectOrgsRequestToQuery(req *auth_pb.ListMyProjectOrgsRequest) (*qu
|
|||||||
}
|
}
|
||||||
return &query.OrgSearchQueries{
|
return &query.OrgSearchQueries{
|
||||||
SearchRequest: query.SearchRequest{
|
SearchRequest: query.SearchRequest{
|
||||||
Offset: offset,
|
Offset: offset,
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Asc: asc,
|
Asc: asc,
|
||||||
|
SortingColumn: org.FieldNameToOrgColumn(req.SortingColumn),
|
||||||
},
|
},
|
||||||
Queries: queries,
|
Queries: queries,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -186,3 +186,14 @@ func DomainValidationTypeFromModel(validationType domain.OrgDomainValidationType
|
|||||||
return org_pb.DomainValidationType_DOMAIN_VALIDATION_TYPE_UNSPECIFIED
|
return org_pb.DomainValidationType_DOMAIN_VALIDATION_TYPE_UNSPECIFIED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FieldNameToOrgColumn(fieldName org_pb.OrgFieldName) query.Column {
|
||||||
|
switch fieldName {
|
||||||
|
case org_pb.OrgFieldName_ORG_FIELD_NAME_NAME:
|
||||||
|
return query.OrgColumnName
|
||||||
|
case org_pb.OrgFieldName_ORG_FIELD_NAME_UNSPECIFIED:
|
||||||
|
return query.Column{}
|
||||||
|
default:
|
||||||
|
return query.Column{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -52,8 +52,9 @@ var (
|
|||||||
table: orgsTable,
|
table: orgsTable,
|
||||||
}
|
}
|
||||||
OrgColumnName = Column{
|
OrgColumnName = Column{
|
||||||
name: projection.OrgColumnName,
|
name: projection.OrgColumnName,
|
||||||
table: orgsTable,
|
table: orgsTable,
|
||||||
|
isOrderByLower: true,
|
||||||
}
|
}
|
||||||
OrgColumnDomain = Column{
|
OrgColumnDomain = Column{
|
||||||
name: projection.OrgColumnDomain,
|
name: projection.OrgColumnDomain,
|
||||||
|
@ -1569,6 +1569,8 @@ message ListMyProjectOrgsRequest {
|
|||||||
zitadel.v1.ListQuery query = 1;
|
zitadel.v1.ListQuery query = 1;
|
||||||
//criteria the client is looking for
|
//criteria the client is looking for
|
||||||
repeated zitadel.org.v1.OrgQuery queries = 2;
|
repeated zitadel.org.v1.OrgQuery queries = 2;
|
||||||
|
// States by which field the results are sorted.
|
||||||
|
zitadel.org.v1.OrgFieldName sorting_column = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListMyProjectOrgsResponse {
|
message ListMyProjectOrgsResponse {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user