Update
/api/v2/badge/update
Post
badges
profiles
Purpose
To allow the admin to update an existing badge.
Body Content [input]
{
secret: string,
badgeID: string,
name: string,
description: string,
icon_type: string,
membersID: string[]
}
Returns if valid [output]
{
message: string,
error: 0
}
What the API does
- Checks if the value of the
secret
field passed is valid [401]. - Checks that
membersID
is not empty [400] and loops through each of its values to ensure that there is a correponding record in theprofiles
collection with these values [404]. - Ensures that there is a
badge
in thebadges
collection corresponding to the value of thebadgeID
field passed [404]. - Saves the document in the
badges
collection corresponding to the value of thebadgeID
field passed using the updated values for thename
,description
,icon_type
and/ormembersID
fields passed.