Skip to content

Commit a91d53f

Browse files
committed
grant badge api description
1 parent 6018bc8 commit a91d53f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

routes/badge/grantBadge.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,24 @@ const badgesClient = new API({
1010
password: process.env.BADGES_PASSWORD,
1111
});
1212

13-
const grantBadge = async function (req, res) {
13+
/**
14+
* @api {post} /grant Grant a badge
15+
* @apiName grandBadge
16+
* @apiDescription Grant a badge to a user.
17+
* @apiGroup Badge
18+
*
19+
* @apiParam {String} email Users Email
20+
* @apiParam {String} badgeClassEntityId ID of the badge class
21+
* @apiParam {ObjectId} createNotification User receives an email notification
22+
* @apiParam {ObjectId} createNotification User receives an email notification
23+
* @apiParam {ObjectId} issuerEntityId ID of the issuer
24+
*
25+
* @apiSuccess (Success 200) {String} message `Badge granted successfully.`
26+
* @apiError (On error) {Obejct} 500 Complications when granting badge
27+
*/
28+
const grantBadge = async (req, res) => {
1429
try {
15-
const email = req.user?.email || req.body.email;
16-
const { badgeClassEntityId, createNotification, issuerEntityId } = req.body;
30+
const { email, badgeClassEntityId, createNotification, issuerEntityId } = req.body;
1731

1832
if (!email) {
1933
return res.status(400).send({

0 commit comments

Comments
 (0)