I am building an app where you can invite your friends to join the platform and discuss various topics. (almost Reddit).

Functionality: When you create a topic you can enter the email of users you want to add. If some of the users are not registered with the platform, we send them an email, asking to get onboarded and see what discussion is happening on the topic.

Implementation: Create an entry in topic table. For user’s being added, check if they exist in user table.

If yes, then create entry in user_topic table.

If no, then add to user table, send an invite to join and created entry in user_topic.

Confusion: Should the user be added to the user table, even though he has not been onboarded to the platform? And when he signs up, we patch in all the details we ask for. Is this the right approach?

Solutions?:

  1. Add users to the table. When the user signs up, we POST a new user, but we patch in the details in the backend. This allows the user to be able to see everything that happened on the topic when he signs up. Issues: We have created an entry for a user even though he is not signed up. You could end up signing up for users who are unwilling.
  2. We create a separate table where we keep track of the topics an unregistered email has signed up. When a new user is being created we check both the user and unregistered_user table and add the user. We do not create a user entry until he signs up. Issues: We have to check two tables when doing any operation. Every reply made to the topic will have to use the two tables.

Question: How do you do it in your application? I am willing to change the approach as well. What is the recommended approach? (not sure if there is one. )

submitted by /u/akshatmalik8
[link] [comments]