mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-12 11:53:39 +00:00
fix: action query (#4257)
This commit is contained in:
parent
cbb5e90bac
commit
e1a981928c
@ -111,9 +111,13 @@ func ActionStateToPb(state domain.ActionState) action_pb.ActionState {
|
||||
func ActionNameQuery(q *action_pb.ActionNameQuery) (query.SearchQuery, error) {
|
||||
return query.NewActionNameSearchQuery(object_grpc.TextMethodToQuery(q.Method), q.Name)
|
||||
}
|
||||
|
||||
func ActionStateQuery(q *action_pb.ActionStateQuery) (query.SearchQuery, error) {
|
||||
return query.NewActionStateSearchQuery(ActionStateToDomain(q.State))
|
||||
}
|
||||
func ActionIDQuery(q *action_pb.ActionIDQuery) (query.SearchQuery, error) {
|
||||
return query.NewActionIDSearchQuery(q.Id)
|
||||
}
|
||||
|
||||
func ActionStateToDomain(state action_pb.ActionState) domain.ActionState {
|
||||
switch state {
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
action_grpc "github.com/zitadel/zitadel/internal/api/grpc/action"
|
||||
"github.com/zitadel/zitadel/internal/api/grpc/object"
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
mgmt_pb "github.com/zitadel/zitadel/pkg/grpc/management"
|
||||
@ -59,6 +60,8 @@ func ActionQueryToQuery(query interface{}) (query.SearchQuery, error) {
|
||||
return action_grpc.ActionNameQuery(q.ActionNameQuery)
|
||||
case *mgmt_pb.ActionQuery_ActionStateQuery:
|
||||
return action_grpc.ActionStateQuery(q.ActionStateQuery)
|
||||
case *mgmt_pb.ActionQuery_ActionIdQuery:
|
||||
return action_grpc.ActionIDQuery(q.ActionIdQuery)
|
||||
}
|
||||
return nil, nil
|
||||
return nil, errors.ThrowInvalidArgument(nil, "MGMT-dsg3z", "Errors.Query.InvalidRequest")
|
||||
}
|
||||
|
@ -148,6 +148,10 @@ func NewActionStateSearchQuery(value domain.ActionState) (SearchQuery, error) {
|
||||
return NewNumberQuery(ActionColumnState, int(value), NumberEquals)
|
||||
}
|
||||
|
||||
func NewActionIDSearchQuery(id string) (SearchQuery, error) {
|
||||
return NewTextQuery(ActionColumnID, id, TextEquals)
|
||||
}
|
||||
|
||||
func prepareActionsQuery() (sq.SelectBuilder, func(rows *sql.Rows) (*Actions, error)) {
|
||||
return sq.Select(
|
||||
ActionColumnID.identifier(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user