-
Notifications
You must be signed in to change notification settings - Fork 1
/
notes.notes
21 lines (17 loc) · 1.74 KB
/
notes.notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
- Following/Follwer explanation
- FOLLOW: Two users with two ids are created as John and Jane. John is id1 and Jane is #2.
- John follows Jane, Jane will get a follower (John) and get added to the followers array of Jane.
- Since John now follows Jane, the id of Jane will be added to the following array of John and vice versa.
- UNFOLLOW: If John unfollows Jane, John id will be removed from the followers array of Jane and Jane will be removed from the following array of John.
- This applies to multiple users as well and the same logic is applied using different ids.
- This method is applied using push and pull methods of MongoDB. Push to add and pull to remove.
- Suggested users will return a list of users that are not followed by the user. This is done by finding all users that are not in the following array of the user. Users that are already followed will not be shown in the suggested users list. Users password will not return a value but instead will return null as
assigned.
- If user is uploading a new cover or image photo, ensure that the new photo overrides the previous image to avoid increase the alloted space in Cloudinary storage.
// Like and unlike
- Like and unlike is implemented using the same logic as follow and unfollow. The only difference is that the like and unlike is done on posts.
- The id of the user will be added to the likes array of the post and the id of the post will be added to the liked array of the user.
- Push will like and pull will unlike.
- Notification will be sent to the user that created the post if the user likes the post. The notification will be stored in the notifications array of the user that created the post.
//Notification
- className="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52"