mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +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>
52 lines
1.5 KiB
Go
52 lines
1.5 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"
|
|
)
|
|
|
|
func FailedEventsViewToPb(failedEvents []*model.FailedEvent) []*admin_pb.FailedEvent {
|
|
events := make([]*admin_pb.FailedEvent, len(failedEvents))
|
|
for i, failedEvent := range failedEvents {
|
|
events[i] = FailedEventViewToPb(failedEvent)
|
|
}
|
|
return events
|
|
}
|
|
|
|
func FailedEventViewToPb(failedEvent *model.FailedEvent) *admin_pb.FailedEvent {
|
|
return &admin_pb.FailedEvent{
|
|
Database: failedEvent.Database,
|
|
ViewName: failedEvent.ViewName,
|
|
FailedSequence: failedEvent.FailedSequence,
|
|
FailureCount: failedEvent.FailureCount,
|
|
ErrorMessage: failedEvent.ErrMsg,
|
|
}
|
|
}
|
|
|
|
func FailedEventsToPb(failedEvents *query.FailedEvents) []*admin_pb.FailedEvent {
|
|
events := make([]*admin_pb.FailedEvent, len(failedEvents.FailedEvents))
|
|
for i, failedEvent := range failedEvents.FailedEvents {
|
|
events[i] = FailedEventToPb(failedEvent)
|
|
}
|
|
return events
|
|
}
|
|
|
|
func FailedEventToPb(failedEvent *query.FailedEvent) *admin_pb.FailedEvent {
|
|
return &admin_pb.FailedEvent{
|
|
Database: "zitadel",
|
|
ViewName: failedEvent.ProjectionName,
|
|
FailedSequence: failedEvent.FailedSequence,
|
|
FailureCount: failedEvent.FailureCount,
|
|
ErrorMessage: failedEvent.Error,
|
|
}
|
|
}
|
|
|
|
func RemoveFailedEventRequestToModel(req *admin_pb.RemoveFailedEventRequest) *model.FailedEvent {
|
|
return &model.FailedEvent{
|
|
Database: req.Database,
|
|
ViewName: req.ViewName,
|
|
FailedSequence: req.FailedSequence,
|
|
}
|
|
}
|