mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 03:54:21 +00:00
ed36680ea1
* fix(system): show views and failed events * fix: set correct database on failed events and views
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
package admin
|
|
|
|
import (
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
"github.com/zitadel/zitadel/internal/view/model"
|
|
admin_pb "github.com/zitadel/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(database string, currentSequences *query.CurrentSequences) []*admin_pb.View {
|
|
v := make([]*admin_pb.View, len(currentSequences.CurrentSequences))
|
|
for i, currentSequence := range currentSequences.CurrentSequences {
|
|
v[i] = CurrentSequenceToPb(database, currentSequence)
|
|
}
|
|
return v
|
|
}
|
|
|
|
func CurrentSequenceToPb(database string, currentSequence *query.CurrentSequence) *admin_pb.View {
|
|
return &admin_pb.View{
|
|
Database: database,
|
|
ViewName: currentSequence.ProjectionName,
|
|
ProcessedSequence: currentSequence.CurrentSequence,
|
|
EventTimestamp: timestamppb.New(currentSequence.Timestamp),
|
|
}
|
|
}
|