add logic to store event modification and deleted event

This commit is contained in:
soukainna
2023-02-01 09:58:37 +01:00
parent 5feb1b720e
commit 301f636072
11 changed files with 364 additions and 122 deletions

View File

@@ -120,3 +120,13 @@ func (s MongoDBStorage) AddSubscription(eventid string, subscription Subscriptio
_, err := collection.UpdateOne(context.TODO(), filter, push)
return err
}
func (s MongoDBStorage) UpdateEvent(event Event) error {
collection := s.Client.Database(s.DbName).Collection(s.Collections["events"])
if _, err := collection.ReplaceOne(context.TODO(), bson.M{"_id": event.ID}, event); err != nil {
fmt.Println(err)
return err
}
return nil
}