2022-04-21 10:37:39 +00:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
|
|
system_pb "github.com/zitadel/zitadel/pkg/grpc/system"
|
2022-04-21 10:37:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Server) ListViews(ctx context.Context, _ *system_pb.ListViewsRequest) (*system_pb.ListViewsResponse, error) {
|
2023-10-19 10:19:10 +00:00
|
|
|
currentSequences, err := s.query.SearchCurrentStates(ctx, new(query.CurrentStateSearchQueries))
|
2022-04-21 10:37:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2023-10-19 10:19:10 +00:00
|
|
|
return &system_pb.ListViewsResponse{Result: CurrentSequencesToPb(s.database, currentSequences)}, nil
|
2022-04-21 10:37:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) ClearView(ctx context.Context, req *system_pb.ClearViewRequest) (*system_pb.ClearViewResponse, error) {
|
2023-10-19 10:19:10 +00:00
|
|
|
err := s.query.ClearCurrentSequence(ctx, req.ViewName)
|
2022-04-21 10:37:39 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &system_pb.ClearViewResponse{}, nil
|
|
|
|
}
|