File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff 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 ( {
You can’t perform that action at this time.
0 commit comments