Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am developing a notification and post system. I have done a database design where there are user ids for who is sending notification, to whom its being sent and notification text field.
Now my question is, should I save the notification with html format what I'll show in front end, like user name, user image etc or just save the raw data and make a join query with users table while fetching the notification.

What is the best structure?

And in facebook we can see post title like "ABC has shared BCD's post". And link on ABC and BCD. So do facebook save the full format in table or format it while fetching the data?

Can you please help me with the good approach please.


What I have tried:

I designed the database as stated above.
Posted
Updated 21-Jan-18 3:01am

1 solution

You should store the raw data such as the ids of the sender and recipient and also the message they want to send. It makes it easier to work with the data and will mean you store less redundant data in your database; you're not storing the "from" and "to" names for example, you just retrieve those when you show the message. It also means that if a user changes their name then when they view the message the correct name is always shown.
 
Share this answer
 
Comments
souvikcode 21-Jan-18 10:09am    
Thanks. I also think to save the raw data, but I'm worried can I set SignalR after fetching data by joining and then push the notification to users?
And what you think facebook also save raw data and while fetching it format as ABC shared BCD's post?
And the links to ABC and BCD are given in front end while showing the data?
F-ES Sitecore 22-Jan-18 4:13am    
I've never used SignalR but I don't see why not. I doubt MS would create a technology that didn't allow you to join tables.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900