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