Skip to content

Commit

Permalink
grant badge api description
Browse files Browse the repository at this point in the history
  • Loading branch information
felixerdy committed Mar 3, 2022
1 parent 6018bc8 commit d25c10b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions routes/badge/grantBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,23 @@ const badgesClient = new API({
password: process.env.BADGES_PASSWORD,
});

const grantBadge = async function (req, res) {
/**
* @api {post} /grant Grant a badge
* @apiName grandBadge
* @apiDescription Grant a badge to a user.
* @apiGroup Badge
*
* @apiParam {String} email Users Email
* @apiParam {String} badgeClassEntityId ID of the badge class
* @apiParam {ObjectId} createNotification User receives an email notification
* @apiParam {ObjectId} issuerEntityId ID of the issuer
*
* @apiSuccess (Success 200) {String} message `Badge granted successfully.`
* @apiError (On error) {Obejct} 500 Complications when granting badge
*/
const grantBadge = async (req, res) => {
try {
const email = req.user?.email || req.body.email;
const { badgeClassEntityId, createNotification, issuerEntityId } = req.body;
const { email, badgeClassEntityId, createNotification, issuerEntityId } = req.body;

if (!email) {
return res.status(400).send({
Expand Down

0 comments on commit d25c10b

Please sign in to comment.