mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-05 22:52:46 +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"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/admin"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/org"
|
||||
)
|
||||
|
||||
func listOrgRequestToModel(req *admin.ListOrgsRequest) (*query.OrgSearchQueries, error) {
|
||||
@ -18,18 +17,9 @@ func listOrgRequestToModel(req *admin.ListOrgsRequest) (*query.OrgSearchQueries,
|
||||
SearchRequest: query.SearchRequest{
|
||||
Offset: offset,
|
||||
Limit: limit,
|
||||
SortingColumn: fieldNameToOrgColumn(req.SortingColumn),
|
||||
SortingColumn: org_grpc.FieldNameToOrgColumn(req.SortingColumn),
|
||||
Asc: asc,
|
||||
},
|
||||
Queries: queries,
|
||||
}, 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{
|
||||
SearchRequest: query.SearchRequest{
|
||||
Offset: offset,
|
||||
Limit: limit,
|
||||
Asc: asc,
|
||||
Offset: offset,
|
||||
Limit: limit,
|
||||
Asc: asc,
|
||||
SortingColumn: org.FieldNameToOrgColumn(req.SortingColumn),
|
||||
},
|
||||
Queries: queries,
|
||||
}, nil
|
||||
|
@ -186,3 +186,14 @@ func DomainValidationTypeFromModel(validationType domain.OrgDomainValidationType
|
||||
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,
|
||||
}
|
||||
OrgColumnName = Column{
|
||||
name: projection.OrgColumnName,
|
||||
table: orgsTable,
|
||||
name: projection.OrgColumnName,
|
||||
table: orgsTable,
|
||||
isOrderByLower: true,
|
||||
}
|
||||
OrgColumnDomain = Column{
|
||||
name: projection.OrgColumnDomain,
|
||||
|
@ -1569,6 +1569,8 @@ message ListMyProjectOrgsRequest {
|
||||
zitadel.v1.ListQuery query = 1;
|
||||
//criteria the client is looking for
|
||||
repeated zitadel.org.v1.OrgQuery queries = 2;
|
||||
// States by which field the results are sorted.
|
||||
zitadel.org.v1.OrgFieldName sorting_column = 3;
|
||||
}
|
||||
|
||||
message ListMyProjectOrgsResponse {
|
||||
|
Loading…
x
Reference in New Issue
Block a user