mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Merge branch 'api-v3-open-mystery-item' of https://github.com/TheHollidayInn/habitrpg into TheHollidayInn-api-v3-open-mystery-item3
This commit is contained in:
@@ -677,7 +677,6 @@ api.disableClasses = {
|
||||
};
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @api {post} /user/purchase/:type/:key Purchase Gem Items.
|
||||
* @apiVersion 3.0.0
|
||||
* @apiName UserPurchase
|
||||
@@ -745,4 +744,24 @@ api.readCard = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {post} /user/open-mystery-item Open the mystery item.
|
||||
* @apiVersion 3.0.0
|
||||
* @apiName UserOpenMysteryItem
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiSuccess {Object} data `user.items.gear.owned`
|
||||
*/
|
||||
api.userOpenMysteryItem = {
|
||||
method: 'POST',
|
||||
middlewares: [authWithHeaders(), cron],
|
||||
url: '/user/open-mystery-item',
|
||||
async handler (req, res) {
|
||||
let user = res.locals.user;
|
||||
let openMysteryItemResponse = common.ops.openMysteryItem(user, req, res.analytics);
|
||||
await user.save();
|
||||
res.respond(200, openMysteryItemResponse);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = api;
|
||||
|
||||
Reference in New Issue
Block a user