2022-04-21 12:37:39 +02:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
2022-11-18 13:49:38 +01:00
|
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
|
|
|
2022-04-27 01:01:45 +02:00
|
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
|
|
system_pb "github.com/zitadel/zitadel/pkg/grpc/system"
|
2022-04-21 12:37:39 +02:00
|
|
|
)
|
|
|
|
|
2023-10-19 12:19:10 +02: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 16:33:50 +02:00
|
|
|
v[i] = CurrentSequenceToPb(database, currentSequence)
|
2022-04-21 12:37:39 +02:00
|
|
|
}
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
2023-10-19 12:19:10 +02:00
|
|
|
func CurrentSequenceToPb(database string, currentSequence *query.CurrentState) *system_pb.View {
|
2022-04-21 12:37:39 +02:00
|
|
|
return &system_pb.View{
|
2022-11-18 13:49:38 +01:00
|
|
|
Database: database,
|
|
|
|
ViewName: currentSequence.ProjectionName,
|
2023-10-19 12:19:10 +02:00
|
|
|
ProcessedSequence: currentSequence.Sequence,
|
|
|
|
LastSuccessfulSpoolerRun: timestamppb.New(currentSequence.LastRun),
|
2022-04-21 12:37:39 +02:00
|
|
|
}
|
|
|
|
}
|