Ported unlock. Add unit tests. Create unlock route. Add integration tests

This commit is contained in:
Keith Holliday
2016-04-06 15:53:32 -05:00
parent a72c6c782d
commit 2bd710a882
7 changed files with 214 additions and 47 deletions

View File

@@ -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;