zitadel/internal/project/repository/view/model/project_member_query.go
Fabi 8bfa1a083c
feat: administrator (#271)
* feat: get views and failed events

* feat: get views and failed events

* feat: get views and failed events

* Update internal/view/repository/sequence.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* Update internal/view/repository/general_query.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2020-06-25 08:01:13 +02:00

70 lines
2.0 KiB
Go

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/repository"
)
type ProjectMemberSearchRequest proj_model.ProjectMemberSearchRequest
type ProjectMemberSearchQuery proj_model.ProjectMemberSearchQuery
type ProjectMemberSearchKey proj_model.ProjectMemberSearchKey
func (req ProjectMemberSearchRequest) GetLimit() uint64 {
return req.Limit
}
func (req ProjectMemberSearchRequest) GetOffset() uint64 {
return req.Offset
}
func (req ProjectMemberSearchRequest) GetSortingColumn() repository.ColumnKey {
if req.SortingColumn == proj_model.ProjectMemberSearchKeyUnspecified {
return nil
}
return ProjectMemberSearchKey(req.SortingColumn)
}
func (req ProjectMemberSearchRequest) GetAsc() bool {
return req.Asc
}
func (req ProjectMemberSearchRequest) GetQueries() []repository.SearchQuery {
result := make([]repository.SearchQuery, len(req.Queries))
for i, q := range req.Queries {
result[i] = ProjectMemberSearchQuery{Key: q.Key, Value: q.Value, Method: q.Method}
}
return result
}
func (req ProjectMemberSearchQuery) GetKey() repository.ColumnKey {
return ProjectMemberSearchKey(req.Key)
}
func (req ProjectMemberSearchQuery) GetMethod() global_model.SearchMethod {
return req.Method
}
func (req ProjectMemberSearchQuery) GetValue() interface{} {
return req.Value
}
func (key ProjectMemberSearchKey) ToColumnName() string {
switch proj_model.ProjectMemberSearchKey(key) {
case proj_model.ProjectMemberSearchKeyEmail:
return ProjectMemberKeyEmail
case proj_model.ProjectMemberSearchKeyFirstName:
return ProjectMemberKeyFirstName
case proj_model.ProjectMemberSearchKeyLastName:
return ProjectMemberKeyLastName
case proj_model.ProjectMemberSearchKeyUserName:
return ProjectMemberKeyUserName
case proj_model.ProjectMemberSearchKeyUserID:
return ProjectMemberKeyUserID
case proj_model.ProjectMemberSearchKeyProjectID:
return ProjectMemberKeyProjectID
default:
return ""
}
}