Merge branch 'api-v3-ops-read-card' of https://github.com/TheHollidayInn/habitrpg into TheHollidayInn-api-v3-ops-read-card

This commit is contained in:
Matteo Pagliazzi
2016-04-01 16:30:48 +02:00
6 changed files with 140 additions and 8 deletions

View File

@@ -677,6 +677,7 @@ api.disableClasses = {
};
/**
<<<<<<< HEAD
* @api {post} /user/purchase/:type/:key Purchase Gem Items.
* @apiVersion 3.0.0
* @apiName UserPurchase
@@ -722,4 +723,26 @@ api.userPurchaseHourglass = {
},
};
/**
* @api {post} /user/read-card/:cardType Reads a card.
* @apiVersion 3.0.0
* @apiName UserReadCard
* @apiGroup User
*
* @apiParam {string} cardType Type of card to read
*
* @apiSuccess {Object} data `items.special flags.cardReceived`
*/
api.readCard = {
method: 'POST',
middlewares: [authWithHeaders(), cron],
url: '/user/read-card/:cardType',
async handler (req, res) {
let user = res.locals.user;
let readCardResponse = common.ops.readCard(user, req);
await user.save();
res.respond(200, readCardResponse);
},
};
module.exports = api;