I am working on a network application and want to create an activity feed so that people can monitor all their connections (classic facebook stream). I have a DB table called activity for this, for example:
activity_id (int) user_id (int)
Then I would do select * from activity where user_id in (connections) to get the latest news.
Here is the catch. User actions do not always have visibility for a full set of connections. Users can create groups of user identifiers to form small sets in their super-set of connections. This is similar to how facebook allows you to specify who sees a particular post, rather than allowing all friends to see it.
I have a separate setup for the groups table with the following schema:
group_id (int) connection_id (user_id, int) user_id (group creator)
I have group_id in my activity table. Group_id is a link to a subset of connections that have permission to view the message.
My question is, what is the best way to make this type of feed, and is there an optimal single select operator that will give me the desired result (a list of my actions with connections, which I got permission to see)
Thanks.
source share