If you have any query feel free to chat us!
Happy Coding! Happy Learning!
In the context of a social media app, friendships refer to the connections between users who want to interact with each other. These connections allow users to view each other's profiles, follow each other's posts, and communicate with each other.
To create friendships, the app needs to store information about the relationship between the users. This information typically includes the user ID of the requester and the user ID of the receiver, along with a status that indicates the current state of the friendship.
In the code, friendships are implemented using a join table called friendships
. This table has three columns: user_id
, friend_id
, and status
. The user_id
column contains the ID of the user who initiated the friendship request, while the friend_id
column contains the ID of the user who received the request. The status
column indicates the current state of the friendship, which can be one of three values: pending
, accepted
, or rejected
.
When a user initiates a friendship request, the app creates a new record in the friendships
table with the status
set to pending
. When the recipient of the request accepts the friendship, the app updates the status
to accepted
. If the recipient rejects the request, the app updates the status
to rejected
.
The code for creating and managing friendships involves a combination of models, controllers, and views. The models define the structure of the friendships
table and provide methods for interacting with it. The controllers handle requests related to creating, accepting, and rejecting friendships. The views provide the user interface for initiating and responding to friendship requests.
Overall, the implementation of friendships in a social media app involves complex database relationships and requires careful consideration of the user experience.
Comments: 2
I am not able to access videos from second class and further. I have already completed first class
When will I get my course?
Now, Your query was resolved.