mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 20:08:02 +00:00
3025ac577b
* search orgs * org by domain * member spooler * member * get roles * tests * types duration * use default func for renew * correct database * reorder migrations * delete unused consts * move get roles to internal * use prepared org by domain * implement org in other objects * add eventstores
68 lines
1.6 KiB
Go
68 lines
1.6 KiB
Go
package view
|
|
|
|
import (
|
|
global_model "github.com/caos/zitadel/internal/model"
|
|
usr_model "github.com/caos/zitadel/internal/org/model"
|
|
"github.com/caos/zitadel/internal/view"
|
|
)
|
|
|
|
type OrgSearchRequest usr_model.OrgSearchRequest
|
|
type OrgSearchQuery usr_model.OrgSearchQuery
|
|
type OrgSearchKey usr_model.OrgSearchKey
|
|
|
|
func (req OrgSearchRequest) GetLimit() uint64 {
|
|
return req.Limit
|
|
}
|
|
|
|
func (req OrgSearchRequest) GetOffset() uint64 {
|
|
return req.Offset
|
|
}
|
|
|
|
func (req OrgSearchRequest) GetSortingColumn() view.ColumnKey {
|
|
if req.SortingColumn == usr_model.ORGSEARCHKEY_UNSPECIFIED {
|
|
return nil
|
|
}
|
|
return OrgSearchKey(req.SortingColumn)
|
|
}
|
|
|
|
func (req OrgSearchRequest) GetAsc() bool {
|
|
return req.Asc
|
|
}
|
|
|
|
func (req OrgSearchRequest) GetQueries() []view.SearchQuery {
|
|
result := make([]view.SearchQuery, len(req.Queries))
|
|
for i, q := range req.Queries {
|
|
result[i] = OrgSearchQuery{Key: q.Key, Value: q.Value, Method: q.Method}
|
|
}
|
|
return result
|
|
}
|
|
|
|
func (req OrgSearchQuery) GetKey() view.ColumnKey {
|
|
return OrgSearchKey(req.Key)
|
|
}
|
|
|
|
func (req OrgSearchQuery) GetMethod() global_model.SearchMethod {
|
|
return req.Method
|
|
}
|
|
|
|
func (req OrgSearchQuery) GetValue() interface{} {
|
|
return req.Value
|
|
}
|
|
|
|
func (key OrgSearchKey) ToColumnName() string {
|
|
switch usr_model.OrgSearchKey(key) {
|
|
case usr_model.ORGSEARCHKEY_ORG_DOMAIN:
|
|
return OrgKeyOrgDomain
|
|
case usr_model.ORGSEARCHKEY_ORG_ID:
|
|
return OrgKeyOrgID
|
|
case usr_model.ORGSEARCHKEY_ORG_NAME:
|
|
return OrgKeyOrgName
|
|
case usr_model.ORGSEARCHKEY_RESOURCEOWNER:
|
|
return OrgKeyResourceOwner
|
|
case usr_model.ORGSEARCHKEY_STATE:
|
|
return OrgKeyState
|
|
default:
|
|
return ""
|
|
}
|
|
}
|