mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Ported release both, added unit tests, add release both route with integration tests
This commit is contained in:
@@ -764,4 +764,24 @@ api.userOpenMysteryItem = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* @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;
|
||||
|
||||
Reference in New Issue
Block a user