Post Save
/api/v2/feed/post/save
Post
posts
profiles
groups
jwt
Purpose
To allow a user to [un]save a post.
Body Content [input]
{
    uid: string,
    postID: string,
    collectionID: string,
    save: bool
}
Returns if valid [output]
{
    message: string,
    error: 0
}
What the API does
- Finds the 
profilecorresponding to theuidpassed and fetches a list of all values inside of thefollowingandblockedfields. - Finds the record from the 
postscollection having apostIDcorresponding to the one passed [404]. - Finds the 
collectionfrom the foundprofilewith a value for itscollectionIDfield corresponding to the one passed [404]. - Ensures that the record found does not have a value for its 
visibilityfield set tonone[403]. - If the record does not have a 
visibilityofnone,followersorpublic, fetch themembersfield of theAccessGroupcorresponding to the value of thevisibilityfield and ensures thatuidis among the values of thatmembersfield [403]. - Ensures that that record’s 
uidfield does not equal to a value among those of the fetchedblockedfield above [403]. - Ensures that the 
profilethat has auidcorresponding to that of the currentpostrecord does not contain a value corresponding to theuidpassed in itsblockedfield [403]. - If the record has a value for its 
groupIDfield, find thegroupcorresponding to thatgroupIDand check ifuidis a value among thatgroup’smembersfield with astatusofaccepted[403]. - Else, if the record does not have a value for its 
groupIDfield, and has a value offollowersfor its visibility field check ifuidis among the values of thefollowingfield or if it is equal to theuidof thepostitself [403]. - If 
savehas a value oftrue, ensure thatpostIDis not already a value among thepostsfield of the foundcollection, else, ifsavehas a value offalse, ensure thatpostIDis a value among thepostsfield of the foundcollection[403]. - Appends and saves the value of 
postIDto thepostsfield of the foundcollectionfrom theprofileof theuserwhoseuidcorresponds to the one passed ifsaveis set totrue, else removespostIDfrom the values of that field.