edit events proto en events.go for visualize history
This commit is contained in:
@@ -26,6 +26,7 @@ func (e Event) ToStorageType() storage.Event {
|
||||
Allday: e.Allday,
|
||||
MaxSubscribers: e.MaxSubscribers,
|
||||
Subscriptions: []storage.Subscription{},
|
||||
DeletedSubscription: []storage.Subscription{},
|
||||
Data: map[string]any{},
|
||||
}
|
||||
|
||||
@@ -33,6 +34,10 @@ func (e Event) ToStorageType() storage.Event {
|
||||
event.Subscriptions = append(event.Subscriptions, v.ToStorageType())
|
||||
}
|
||||
|
||||
for _, v := range e.DeletedSubscription {
|
||||
event.DeletedSubscription = append(event.DeletedSubscription, v.ToStorageType())
|
||||
}
|
||||
|
||||
for k, d := range e.Data.GetFields() {
|
||||
jsondata, err := protojson.Marshal(d)
|
||||
if err != nil {
|
||||
@@ -72,12 +77,18 @@ func EventFromStorageType(event *storage.Event) (*Event, error) {
|
||||
}
|
||||
|
||||
subscriptions := []*Subscription{}
|
||||
deletedsubscription := []*Subscription{}
|
||||
|
||||
for _, v := range event.Subscriptions {
|
||||
sub, _ := SubscriptionFromStorageType(v)
|
||||
subscriptions = append(subscriptions, sub)
|
||||
}
|
||||
|
||||
for _, v := range event.DeletedSubscription {
|
||||
sub, _ := SubscriptionFromStorageType(v)
|
||||
deletedsubscription = append(deletedsubscription, sub)
|
||||
}
|
||||
|
||||
return &Event{
|
||||
Id: event.ID,
|
||||
Namespace: event.Namespace,
|
||||
@@ -93,6 +104,7 @@ func EventFromStorageType(event *storage.Event) (*Event, error) {
|
||||
Allday: event.Allday,
|
||||
MaxSubscribers: event.MaxSubscribers,
|
||||
Subscriptions: subscriptions,
|
||||
DeletedSubscription: deletedsubscription,
|
||||
Data: data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user