mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user