Fetch All
/api/v2/profile/fetch
Post
users
profiles
jwt
pgn
Purpose
To allow a user to fetch other entities’ profiles.
Body Content [input]
{
uid: string
}
Returns if valid [output]
{
profiles: {
profileID: string,
name: string,
username: string,
profile_pic: string,
cover_image: string,
bio: string,
account_type: string,
followers: string[],
following: string[],
followers_length: int,
following_length: int,
highlights: {
highlightID: string,
name: string,
icon: string,
storiesID: string[],
visibility: string,
created_on: Date
}[]
}[],
error: 0,
amount: int
}
What the API does
- Find all records from the
usersandprofilescollection with auidnot corresponding to the one passed. - Filter out the results by removing records which have the
uidpassed as a value included in theirblockedfield or which have a value offalsefor theiractivefield or a value oftruefor theirdeactivatedfield. - Filter out the results by removing records which have an
account_typeofghostand do not contain the passeduidin theirfollowingfield. - Set empty values for
followersandfollowingunless theaccount_typeis set topublic. - Set blank value for
profile_pic,cover_imageandbiounless theaccount_typeis set topublicorrestrictedor if the record contains the passeduidin itsfollowersfield. - Set blank value for
followers_lengthandfollowing_lengthunless theaccount_typeis set topublicorrestrictedor if the record has anaccount_typeofprivateand contains the passeduidin itsfollowersfield. Anaccount_typeofghostwill always have everything linked to itsfollowersandfollowingset to hidden. - Set blank value for
highlightsunless theaccount_typeis set topublicor if the record contains the passeduidin itsfollowersfield. - If
account_typeis set topublicor if the record contains the passeduidin itsfollowersfield, loop through eachhighlightin thehighlightsfield. Remove the highlight if it has avisibilityofnone, or if it is set tofollowersand the passeduidis not in theprofileof the currentuser’sfollowersfield. If the highlight has a visibility other thanpublic,followersornone, find theAccessGroupwith the value corresponding tovisibilityfor itsaccessIDfield and remove thathighlightifuidis not among the values of thatAccessGroup’smembersfield. - Filter and keep only the
profileID,nameandusernameof any record if theuidis among one of the values inside of theblockedfield of theprofileidentified by theuidpassed.