View
/api/v2/story/view
Post
stories
profiles
jwt
Purpose
To allow a user to mark a story from a user that he/she follows that he/she is allowed to view as viewed.
Body Content [input]
{
uid: string,
storyID: string
}
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
storyrecords from thestoriescollection corresponding to thestoryIDpassed. - Skip everything that follows until the last 2 points if the record’s
uidhas a value equal to the one passed. - Ensures that that record does not have a
visibilityset tonone[403]. - If the record does not have a
visibilityofnone,followersorpublic, fetch themembersfield of theAccessGroupcorresponding to the value of thevisibilityfield and check ifuidis among the values of thatmembersfield [403]. - Ensures that the value of the
storyrecord’suidfield is not among that of the fetchedblockedfield above [403]. - Finds the
profilethat has auidcorresponding to that of the currentstoryrecord, and ensures that the value of theuidpassed is not among those of the fetchedprofile’sblockedfield. - If the record has a value of
followersfor its visibility field, check ifuidis among the values of thefollowingfield [403]. - Checks that the current day / time minus the value of the
posted_onfield of thatstoryrecord is less than 24 hours [403]. - Updates the
storiescollection by appending the value of theuidpassed to theviewsfield of the record corresponding to the value ofstoryIDifuidis not already a value among that field.