Follow
/api/v2/profile/follow
Post
profiles
notifications
jwt
Purpose
To allow a user to follow another user.
Body Content [input]
{
    uid: string,
    profileID: string,
    status: bool
}
Returns if valid [output]
{
    message: string,
    error: 0
}
What the API does
- Checks that 
uidandprofileIDaren’t the same value [403]. - Fetches the profile for the record with a 
uidcorresponding to theuidpassed (src) [404]. - Fetches the profile for the record with a 
uidcorresponding to theprofileIDpassed (dest) [404]. - Ensure that neither 
uidis found indest’sblockedfield nor thatprofileIDis found insrc’sblockedfield [403]. - Ensure that 
profileIDis not insrc’sfollowingorsent_follow_requestsfield ifstatusistrueand thatprofileIDis insrc’sfollowingorsent_follow_requestsfield ifstatusisfalse[403]. - If 
dest’saccount_typeis set topublicorstatusis equal tofalse, do the following:- Append or filter out 
profileIDinsrc’sfollowingdepending on the value ofstatus. - Append or filter out 
uidindest’sfollowersdepending on the value ofstatus. 
 - Append or filter out 
 - Else if 
dest’saccount_typeis set toprivateorrestricted, do the following:- Append or filter out 
profileIDinsrc’ssent_follow_requestsdepending on the value ofstatus. - Append or filter out 
uidindest’sreceived_follow_requestsdepending on the value ofstatus. 
 - Append or filter out 
 - Do the same thing as above if 
dest’saccount_typeis set toghostand hasuidas value among itsfollowingfield. - Generates a new 
notificationIDand atimestampcorresponding to the current date and time, and creates a new object in thenotificationscollection with the following data ifstatushas a value oftrue:{ uid: profileID, notificationID: notificationID, content: `uid.${uid} has sent you a follow request`, profileID: uid, type: "follow_send", created_on: timestamp, read: false, redirect: `/profile/${uid}` }If
dest’saccount_typeis set topublic, make thecontentfield of the above object have a value of “${username} is now following you” instead.