More data on subscriptions

This commit is contained in:
2022-10-17 05:00:35 +02:00
parent 3699479c5e
commit 4a26fc791c
7 changed files with 199 additions and 50 deletions

View File

@@ -111,11 +111,11 @@ func (s MongoDBStorage) GetEvents(namespaces []string) (events []Event, err erro
return
}
func (s MongoDBStorage) AddSubscriber(eventid string, subscriber string) error {
func (s MongoDBStorage) AddSubscription(eventid string, subscription Subscription) error {
collection := s.Client.Database(s.DbName).Collection(s.Collections["events"])
filter := bson.M{"_id": eventid}
push := bson.M{"$push": bson.M{"subscribers": subscriber}}
push := bson.M{"$push": bson.M{"subscriptions": subscription}}
_, err := collection.UpdateOne(context.TODO(), filter, push)
return err