diff --git a/src/services/shop/shop-router.ts b/src/services/shop/shop-router.ts index 88ecbc3b..c31762e9 100644 --- a/src/services/shop/shop-router.ts +++ b/src/services/shop/shop-router.ts @@ -263,7 +263,7 @@ shopRouter.get("/item/qr/:ITEMID", strongJwtVerification, async (req: Request, r }); /** - * @api {post} /shop/item/buy/:ITEMID/ POST /shop/item/buy/:ITEMID/ + * @api {post} /shop/item/buy/ POST /shop/item/buy/ * @apiGroup Shop * @apiDescription Purchase item at the point shop using provided QR code. * @@ -278,7 +278,7 @@ shopRouter.get("/item/qr/:ITEMID", strongJwtVerification, async (req: Request, r * } * * @apiUse strongVerifyErrors - * @apiError (200: Success) {String} Success Purchase was successful. + * @apiError (200: Success) {String} Success Purchase was successful. Returns purchased item name on success. * @apiError (404: Forbidden) {String} AttendeeProfileNotFound User has no attendee profile. * @apiError (404: Not Found) {String} ItemNotFound Item with itemId not found or already purchased. * @apiError (404: Not Found) {String} InvalidUniqueItem This unique item is already purchased or doesn't exist. @@ -321,11 +321,15 @@ shopRouter.post("/item/buy", strongJwtVerification, async (req: Request, res: Re }, ); + const targetItem = await Models.ShopItem.findOne({ itemId: itemId }); + // decrement attendee coins if (updatedShopQuantity) { await updateCoins(userId, -itemFormat.price).then(console.error); } - return res.status(StatusCode.SuccessOK).send({ success: true }); + return res + .status(StatusCode.SuccessOK) + .send({ success: true, itemName: targetItem ? targetItem["name"] : "Item Doesn't Exist :(" }); } return next(new RouterError(StatusCode.ClientErrorNotFound, "InvalidUniqueItem"));