mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Ported unlock. Add unit tests. Create unlock route. Add integration tests
This commit is contained in:
@@ -848,4 +848,24 @@ api.userSell = {
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* @api {post} /user/unlock Unlocks items by purchase.
|
||||
* @apiVersion 3.0.0
|
||||
* @apiName UserUnlock
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiSuccess {Object} data `purchased preferences items`
|
||||
*/
|
||||
api.userUnlock = {
|
||||
method: 'POST',
|
||||
middlewares: [authWithHeaders(), cron],
|
||||
url: '/user/unlock',
|
||||
async handler (req, res) {
|
||||
let user = res.locals.user;
|
||||
let unlockResponse = common.ops.unlock(user, req);
|
||||
await user.save();
|
||||
res.respond(200, unlockResponse);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = api;
|
||||
|
||||
Reference in New Issue
Block a user