Retweet Function Design

Source: Internet
Author: User
For example, suppose I have several tables {code ...} in the table, friendships contains the relationship between the following user and the followed user. retweet indicates the relationship between the forwarded tweet and the user, how can I implement the following requirements? My retweet needs to be displayed on the timeline of the person who follows me .... For example, suppose I have the following tables:

tweets    id    user_id    text    created_atretweets    tweet_id    user_id    created_atusers    id    ...friendships    ...

In the table, friendships contains the relationship between the following user and the followed user. retweet indicates the relationship between the forwarded tweet and the user. How can I implement the following requirements?

  1. My retweet needs to be displayed on the timeline of the person who follows me.
  2. In addition, the time order of this tweet on the timeline of the people who follow me needs to be sorted by the time point of my retweet, andNoThe original tweet time.
  3. Do not change the table design. For example, merge retweet and tweet and add a parent_id field.

Reply content:

For example, suppose I have the following tables:

tweets    id    user_id    text    created_atretweets    tweet_id    user_id    created_atusers    id    ...friendships    ...

In the table, friendships contains the relationship between the following user and the followed user. retweet indicates the relationship between the forwarded tweet and the user. How can I implement the following requirements?

  1. My retweet needs to be displayed on the timeline of the person who follows me.
  2. In addition, the time order of this tweet on the timeline of the people who follow me needs to be sorted by the time point of my retweet, andNoThe original tweet time.
  3. Do not change the table design. For example, merge retweet and tweet and add a parent_id field.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.