mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
fa9f581d56
* chore: move to new org * logging * fix: org rename caos -> zitadel Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package system
|
|
|
|
import (
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
"github.com/zitadel/zitadel/internal/view/model"
|
|
system_pb "github.com/zitadel/zitadel/pkg/grpc/system"
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
)
|
|
|
|
func ViewsToPb(views []*model.View) []*system_pb.View {
|
|
v := make([]*system_pb.View, len(views))
|
|
for i, view := range views {
|
|
v[i] = ViewToPb(view)
|
|
}
|
|
return v
|
|
}
|
|
|
|
func ViewToPb(view *model.View) *system_pb.View {
|
|
return &system_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) []*system_pb.View {
|
|
v := make([]*system_pb.View, len(currentSequences.CurrentSequences))
|
|
for i, currentSequence := range currentSequences.CurrentSequences {
|
|
v[i] = CurrentSequenceToPb(currentSequence)
|
|
}
|
|
return v
|
|
}
|
|
|
|
func CurrentSequenceToPb(currentSequence *query.CurrentSequence) *system_pb.View {
|
|
return &system_pb.View{
|
|
Database: "zitadel",
|
|
ViewName: currentSequence.ProjectionName,
|
|
ProcessedSequence: currentSequence.CurrentSequence,
|
|
EventTimestamp: timestamppb.New(currentSequence.Timestamp),
|
|
}
|
|
}
|