michaelklem / alertwalker_mobile

Mobile React Native app for Alert Walker
0 stars 0 forks source link

Event subscriptions population #4

Open tgreco opened 2 years ago

tgreco commented 2 years ago
  1. Looking at mongodb, there is only a single eventsubscriptions record. How do these get created? I thought each user would need one, but for some reason, only one exists in the allertwalker-dv db. The db you created has a lot more.
tgreco commented 2 years ago

There are two ways to populate the eventsubscription records.

  1. When a user registers UserManager.register will call NotificationManagers.subscribeUserToEvents which populates this collection.
  2. If you add a new subscibableevent record then you need to manually populate the eventsubscription collection for this new subscribable event. If you invoke the API route notification/update-subscriptions as an admin user this will populate the event subscriptions. It has logic to prevent duplicates so don't worry about calling it.

I have already invoked the API route so the records were created now.