Some queries in overall design

  1. Why do we have user_id and entity_id in feeditem table?It does not make sense?I am not able to understand what is it indicating/? If userid is x and entityid is y, what does it mean?I thing group,users and pages should be separated out as these are separate entities that might be having their own attributes.
  2. Why are you maintain time in DateTime lastGenerated, it is not can be accepted as a parameter.
  3. The linkedlisthashmap will not you return data, and user ask new data there is possibility that we got some recent updates,so we need to reorganise data and send again

Hi Rahul

So from what I could understand user_id is there for indicating which user posted the FeedItem. entity_id is there for indicating which page this FeedItem was posted on. Remember, Users do make posts (here known as FeedItems) on pages.
If you check the DB design, User is one table, Entity (which signifies groups or pages) is a separate table. Both of them have their own attributes.
I hope this answers your question number 1.
As to the question 3, I am having doubts about the need of the linkedhashmap itself. We already have a LRU cache there, which should be sufficient. Maybe on the client side, but not on the server side definitely.

Cheers!! user_id can be page id, or user_id etc, they should have named it properly.

user_id cannot be page_id, entity_id can be page or group_id.

there should be one id and one type column , where type tell its user/page/group and id tells its id.otherwise userid is null for page and group and entity is null for user in current design they proposed

the type is there in the UserFollow table. that’s how they generate news feed. by looking at all the users and pages you follow.
the SQL query given is pretty much indicative of the same.

this might not be true, some user with a user id say “rahul” (here it’d be a number i just am using string to home in my point), has posted a FeedItem on a page with entity id “rahuls_page”, the FeedItem would have both in that case, is what I guess

P.S. I am also a learner like you, I hope some of the course creators or moderators do answer our queries. I have posted a few questions myself on some other designs.