Update
/api/v2/highlight/update
Post
stories
profiles
jwt
Purpose
To allow a user to update an existing highlight of stories on his/her profile.
Body Content [input]
{
uid: string,
highlightID: string,
name: string,
icon: string,
stories: string[],
visibility: string
}
Returns if valid [output]
{
message: string,
error: 0
}
What the API does
- Validates the value of the
visibilityfield passed to make sure that its value is eitherpublic,followers,noneor one among theaccessIDs found in theaccess_groupsfield in the record corresponding to that of theuidpassed from theprofilescollection [400]. - Loops through each of the values of the
storiesfield and guarantees that there is astorywith thatstoryIDinside of thestoriescollection [404] and which has the sameuidas that passed [403]. - Finds the
profileof the record corresponding to theuidpassed from theprofilescollection and updates and saves the object corresponding to thehighlightIDpassed [404] with the updated values of thename,icon,storiesIDand/orvisibilityfields passed.