mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-20 23:07:33 +00:00
3a63fb765a
* cleanup todo * fix: some todos
36 lines
960 B
Go
36 lines
960 B
Go
package admin
|
|
|
|
import (
|
|
"github.com/zitadel/zitadel/internal/api/grpc/object"
|
|
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) {
|
|
offset, limit, asc := object.ListQueryToModel(req.Query)
|
|
queries, err := org_grpc.OrgQueriesToModel(req.Queries)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &query.OrgSearchQueries{
|
|
SearchRequest: query.SearchRequest{
|
|
Offset: offset,
|
|
Limit: limit,
|
|
SortingColumn: 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{}
|
|
}
|
|
}
|