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
profile
corresponding to theuid
passed and fetches a list of all values inside of thefollowing
andblocked
fields. - Finds the
story
records from thestories
collection corresponding to thestoryID
passed. - Skip everything that follows until the last 2 points if the record’s
uid
has a value equal to the one passed. - Ensures that that record does not have a
visibility
set tonone
[403]. - If the record does not have a
visibility
ofnone
,followers
orpublic
, fetch themembers
field of theAccessGroup
corresponding to the value of thevisibility
field and check ifuid
is among the values of thatmembers
field [403]. - Ensures that the value of the
story
record’suid
field is not among that of the fetchedblocked
field above [403]. - Finds the
profile
that has auid
corresponding to that of the currentstory
record, and ensures that the value of theuid
passed is not among those of the fetchedprofile
’sblocked
field. - If the record has a value of
followers
for its visibility field, check ifuid
is among the values of thefollowing
field [403]. - Checks that the current day / time minus the value of the
posted_on
field of thatstory
record is less than 24 hours [403]. - Updates the
stories
collection by appending the value of theuid
passed to theviews
field of the record corresponding to the value ofstoryID
ifuid
is not already a value among that field.