mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
8bfa1a083c
* feat: get views and failed events * feat: get views and failed events * feat: get views and failed events * Update internal/view/repository/sequence.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * Update internal/view/repository/general_query.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
42 lines
970 B
Go
42 lines
970 B
Go
package grpc
|
|
|
|
import (
|
|
view_model "github.com/caos/zitadel/internal/view/model"
|
|
)
|
|
|
|
func viewsFromModel(views []*view_model.View) []*View {
|
|
result := make([]*View, len(views))
|
|
for i, view := range views {
|
|
result[i] = viewFromModel(view)
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
func failedEventsFromModel(failedEvents []*view_model.FailedEvent) []*FailedEvent {
|
|
result := make([]*FailedEvent, len(failedEvents))
|
|
for i, view := range failedEvents {
|
|
result[i] = failedEventFromModel(view)
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
func viewFromModel(view *view_model.View) *View {
|
|
return &View{
|
|
Database: view.Database,
|
|
ViewName: view.ViewName,
|
|
Sequence: view.CurrentSequence,
|
|
}
|
|
}
|
|
|
|
func failedEventFromModel(failedEvent *view_model.FailedEvent) *FailedEvent {
|
|
return &FailedEvent{
|
|
Database: failedEvent.Database,
|
|
ViewName: failedEvent.ViewName,
|
|
FailedSequence: failedEvent.FailedSequence,
|
|
FailureCount: failedEvent.FailureCount,
|
|
ErrorMessage: failedEvent.ErrMsg,
|
|
}
|
|
}
|