mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
a43e1fc34a
* feat: change failed events to new projection * feat: change failed events to new projection * feat: change current sequences to new projection * feat: add tests * Update internal/api/grpc/admin/failed_event.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * Update internal/api/grpc/admin/view.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: truncate * fix reset * fix reset * Rename V1.102__queries.sql to V1.103__queries.sql * improve current_sequence and truncate view tables * check sub tables of view are tables * Update internal/query/current_sequence_test.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * fixes and use squirrel * missing error handling * lock before reset Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Silvan <silvan.reusser@gmail.com>
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package admin
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/internal/query"
|
|
admin_pb "github.com/caos/zitadel/pkg/grpc/admin"
|
|
)
|
|
|
|
func (s *Server) ListViews(ctx context.Context, _ *admin_pb.ListViewsRequest) (*admin_pb.ListViewsResponse, error) {
|
|
currentSequences, err := s.query.SearchCurrentSequences(ctx, new(query.CurrentSequencesSearchQueries))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
convertedCurrentSequences := CurrentSequencesToPb(currentSequences)
|
|
views, err := s.administrator.GetViews()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
convertedViews := ViewsToPb(views)
|
|
|
|
convertedCurrentSequences = append(convertedCurrentSequences, convertedViews...)
|
|
return &admin_pb.ListViewsResponse{Result: convertedCurrentSequences}, nil
|
|
}
|
|
|
|
func (s *Server) ClearView(ctx context.Context, req *admin_pb.ClearViewRequest) (*admin_pb.ClearViewResponse, error) {
|
|
var err error
|
|
if req.Database != "zitadel" {
|
|
err = s.administrator.ClearView(ctx, req.Database, req.ViewName)
|
|
} else {
|
|
err = s.query.ClearCurrentSequence(ctx, req.ViewName)
|
|
}
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &admin_pb.ClearViewResponse{}, nil
|
|
}
|