Link Search Menu Expand Document

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 the uid passed and fetches a list of all values inside of the following and blocked fields.
  • Finds the story records from the stories collection corresponding to the storyID 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 to none [403].
  • If the record does not have a visibility of none, followers or public, fetch the members field of the AccessGroup corresponding to the value of the visibility field and check if uid is among the values of that members field [403].
  • Ensures that the value of the story record’s uid field is not among that of the fetched blocked field above [403].
  • Finds the profile that has a uid corresponding to that of the current story record, and ensures that the value of the uid passed is not among those of the fetched profile’s blocked field.
  • If the record has a value of followers for its visibility field, check if uid is among the values of the following field [403].
  • Checks that the current day / time minus the value of the posted_on field of that story record is less than 24 hours [403].
  • Updates the stories collection by appending the value of the uid passed to the views field of the record corresponding to the value of storyID if uid is not already a value among that field.