Post
/api/v2/notification/post
Post
notifications
profiles
jwt
disabled
Purpose
To allow a user to create a notification for another user.
Body Content [input]
{
uid: string,
profileID: string,
content: string,
type: string,
redirect: string
}
Returns if valid [output]
{
message: string,
error: 0
}
What the API does
- Fetches the
profile
for both that corresponding touid
and that corresponding toprofileID
, and ensures that neither is a value among the values of theblocked
field of the other [403]. - Generates a unique
notificationID
and atimestamp
corresponding to the current date and time. - Creates and saves a new object inside of the
notifications
collection with the value ofprofileID
corresponding to that of theuid
field, the value ofuid
corresponding to that of theprofileID
field, uses the passedcontent
,type
andredirect
as well as the value of the generatednotificationID
and the value of the generatedtimestamp
field for thecreated_on
field.