2020-05-11 10:16:29 +00:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
global_model "github.com/caos/zitadel/internal/model"
|
|
|
|
proj_model "github.com/caos/zitadel/internal/project/model"
|
|
|
|
"github.com/caos/zitadel/internal/view"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ProjectRoleSearchRequest proj_model.ProjectRoleSearchRequest
|
|
|
|
type ProjectRoleSearchQuery proj_model.ProjectRoleSearchQuery
|
|
|
|
type ProjectRoleSearchKey proj_model.ProjectRoleSearchKey
|
|
|
|
|
|
|
|
func (req ProjectRoleSearchRequest) GetLimit() uint64 {
|
|
|
|
return req.Limit
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req ProjectRoleSearchRequest) GetOffset() uint64 {
|
|
|
|
return req.Offset
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req ProjectRoleSearchRequest) GetSortingColumn() view.ColumnKey {
|
2020-06-23 12:47:47 +00:00
|
|
|
if req.SortingColumn == proj_model.ProjectRoleSearchKeyUnspecified {
|
2020-05-11 10:16:29 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return ProjectRoleSearchKey(req.SortingColumn)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req ProjectRoleSearchRequest) GetAsc() bool {
|
|
|
|
return req.Asc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req ProjectRoleSearchRequest) GetQueries() []view.SearchQuery {
|
|
|
|
result := make([]view.SearchQuery, len(req.Queries))
|
|
|
|
for i, q := range req.Queries {
|
|
|
|
result[i] = ProjectRoleSearchQuery{Key: q.Key, Value: q.Value, Method: q.Method}
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req ProjectRoleSearchQuery) GetKey() view.ColumnKey {
|
|
|
|
return ProjectRoleSearchKey(req.Key)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req ProjectRoleSearchQuery) GetMethod() global_model.SearchMethod {
|
|
|
|
return req.Method
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req ProjectRoleSearchQuery) GetValue() interface{} {
|
|
|
|
return req.Value
|
|
|
|
}
|
|
|
|
|
|
|
|
func (key ProjectRoleSearchKey) ToColumnName() string {
|
|
|
|
switch proj_model.ProjectRoleSearchKey(key) {
|
2020-06-23 12:47:47 +00:00
|
|
|
case proj_model.ProjectRoleSearchKeyKey:
|
2020-05-11 10:16:29 +00:00
|
|
|
return ProjectRoleKeyKey
|
2020-06-23 12:47:47 +00:00
|
|
|
case proj_model.ProjectRoleSearchKeyOrgID:
|
2020-05-11 10:16:29 +00:00
|
|
|
return ProjectRoleKeyOrgID
|
2020-06-23 12:47:47 +00:00
|
|
|
case proj_model.ProjectRoleSearchKeyProjectID:
|
2020-05-11 10:16:29 +00:00
|
|
|
return ProjectRoleKeyProjectID
|
2020-06-23 12:47:47 +00:00
|
|
|
case proj_model.ProjectRoleSearchKeyResourceOwner:
|
2020-05-11 10:16:29 +00:00
|
|
|
return ProjectRoleKeyResourceOwner
|
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|