2022-04-21 10:37:39 +00:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
2022-11-18 12:49:38 +00:00
|
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
|
|
system_pb "github.com/zitadel/zitadel/pkg/grpc/system"
|
2022-04-21 10:37:39 +00:00
|
|
|
)
|
|
|
|
|
2023-10-19 10:19:10 +00:00
|
|
|
func CurrentSequencesToPb(database string, currentSequences *query.CurrentStates) []*system_pb.View {
|
|
|
|
v := make([]*system_pb.View, len(currentSequences.CurrentStates))
|
|
|
|
for i, currentSequence := range currentSequences.CurrentStates {
|
2022-05-31 14:33:50 +00:00
|
|
|
v[i] = CurrentSequenceToPb(database, currentSequence)
|
2022-04-21 10:37:39 +00:00
|
|
|
}
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
2023-10-19 10:19:10 +00:00
|
|
|
func CurrentSequenceToPb(database string, currentSequence *query.CurrentState) *system_pb.View {
|
2022-04-21 10:37:39 +00:00
|
|
|
return &system_pb.View{
|
2022-11-18 12:49:38 +00:00
|
|
|
Database: database,
|
|
|
|
ViewName: currentSequence.ProjectionName,
|
2023-10-19 10:19:10 +00:00
|
|
|
ProcessedSequence: currentSequence.Sequence,
|
|
|
|
LastSuccessfulSpoolerRun: timestamppb.New(currentSequence.LastRun),
|
2022-04-21 10:37:39 +00:00
|
|
|
}
|
|
|
|
}
|