Design Application to "Actively" Invite Users (pretend they have privileges)

Posted by user3086451 on Programmers See other posts from Programmers or by user3086451
Published on 2013-12-10T11:22:18Z Indexed on 2014/06/08 21:40 UTC
Read the original article Hit count: 361

I am designing an application where users message one another privately, and may send messages to any Entity in the database (an Entity may not have a user account yet, it is a professional database). I am not sure how to best design the database and the API to allow messaging unregistered users. The application should remain secure, and data only accessed by those with correct permissions.

Messages sent to persons without user accounts serve as an invitation. The invited person should be able to view the message, act on it, and complete the user registration upon receiving an InviteMessage.

In simple terms, I have:

User
    misc user fields (email, pw, dateJoined)

Entity (large professional dataset):
   personalDetails... 
   user->User (may be null) 

UserMessage:
   sender->User 
   recipient->User
   dateCreated
   messageContent, other fields.....

InviteMessage:
   sender->User
   recipient->Entity
   expiringUrl
   inviteeEmail
   inviteePhone

I plan to alert the user when selecting a recipient that is not registered yet, and inform that he may send the message as an invitation by providing email, phone where we can send the invitation.

Invitations will have a unique, one-time-use URL, e.g. uuid.uuid4(). When accessed, the invitee will see the InviteMessage and details about completing his/her registration profile.

When registration is complete, InviteMessage details to a new instance of UserMessage (to not lose their data), and assign it to the newly created User.

The ability to interact with and invite persons who do not yet have accounts is a key feature of the application, and it seems better to separate the invitation from the private, app messages (easier to keep functionality separate, better if data model changes).

  • Is this a reasonable, good design?
  • If not, what would you suggest?
  • Do you have any improvements?
  • Am I correct to choose to create a separate endpoint for creating invitations via the API?

© Programmers or respective owner

Related posts about web-applications

Related posts about database-design