mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-18 13:57:32 +00:00
35 lines
893 B
Go
35 lines
893 B
Go
package admin
|
|
|
|
import (
|
|
"github.com/caos/zitadel/internal/api/grpc/object"
|
|
org_grpc "github.com/caos/zitadel/internal/api/grpc/org"
|
|
"github.com/caos/zitadel/internal/domain"
|
|
"github.com/caos/zitadel/internal/org/model"
|
|
"github.com/caos/zitadel/pkg/grpc/admin"
|
|
)
|
|
|
|
func listOrgRequestToModel(req *admin.ListOrgsRequest) (*model.OrgSearchRequest, error) {
|
|
offset, limit, asc := object.ListQueryToModel(req.Query)
|
|
queries, err := org_grpc.OrgQueriesToModel(req.Queries)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &model.OrgSearchRequest{
|
|
Offset: offset,
|
|
Limit: limit,
|
|
Asc: asc,
|
|
Queries: queries,
|
|
}, nil
|
|
}
|
|
|
|
func setUpOrgOrgToDomain(req *admin.SetUpOrgRequest_Org) *domain.Org {
|
|
org := &domain.Org{
|
|
Name: req.Name,
|
|
Domains: []*domain.OrgDomain{},
|
|
}
|
|
if req.Domain != "" {
|
|
org.Domains = append(org.Domains, &domain.OrgDomain{Domain: req.Domain})
|
|
}
|
|
return org
|
|
}
|