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

This commit is contained in:
Matteo Pagliazzi
2016-04-04 11:46:46 +02:00
6 changed files with 224 additions and 40 deletions

View File

@@ -784,4 +784,24 @@ api.userReleasePets = {
},
};
/*
* @api {post} /user/release-both Releases Pets and Mounts and grants Triad Bingo.
* @apiVersion 3.0.0
* @apiName UserReleaseBoth
* @apiGroup User
*
* @apiSuccess {Object} data `user.items.gear.owned`
*/
api.userReleaseBoth = {
method: 'POST',
middlewares: [authWithHeaders(), cron],
url: '/user/release-both',
async handler (req, res) {
let user = res.locals.user;
let releaseBothResponse = common.ops.releaseBoth(user, req, res.analytics);
await user.save();
res.respond(200, releaseBothResponse);
},
};
module.exports = api;