mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 11:34:26 +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>
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package admin
|
|
|
|
import (
|
|
"github.com/caos/zitadel/internal/query"
|
|
"github.com/caos/zitadel/internal/view/model"
|
|
admin_pb "github.com/caos/zitadel/pkg/grpc/admin"
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
)
|
|
|
|
func ViewsToPb(views []*model.View) []*admin_pb.View {
|
|
v := make([]*admin_pb.View, len(views))
|
|
for i, view := range views {
|
|
v[i] = ViewToPb(view)
|
|
}
|
|
return v
|
|
}
|
|
|
|
func ViewToPb(view *model.View) *admin_pb.View {
|
|
return &admin_pb.View{
|
|
Database: view.Database,
|
|
ViewName: view.ViewName,
|
|
LastSuccessfulSpoolerRun: timestamppb.New(view.LastSuccessfulSpoolerRun),
|
|
ProcessedSequence: view.CurrentSequence,
|
|
EventTimestamp: timestamppb.New(view.EventTimestamp),
|
|
}
|
|
}
|
|
|
|
func CurrentSequencesToPb(currentSequences *query.CurrentSequences) []*admin_pb.View {
|
|
v := make([]*admin_pb.View, len(currentSequences.CurrentSequences))
|
|
for i, currentSequence := range currentSequences.CurrentSequences {
|
|
v[i] = CurrentSequenceToPb(currentSequence)
|
|
}
|
|
return v
|
|
}
|
|
|
|
func CurrentSequenceToPb(currentSequence *query.CurrentSequence) *admin_pb.View {
|
|
return &admin_pb.View{
|
|
Database: "zitadel",
|
|
ViewName: currentSequence.ProjectionName,
|
|
ProcessedSequence: currentSequence.CurrentSequence,
|
|
EventTimestamp: timestamppb.New(currentSequence.Timestamp),
|
|
}
|
|
}
|