port allocateNow and autoAllocate

This commit is contained in:
Matteo Pagliazzi
2016-03-20 20:21:15 +01:00
parent 480194f53c
commit bd3c162b97
8 changed files with 237 additions and 58 deletions

View File

@@ -196,6 +196,26 @@ api.allocate = {
},
};
/**
* @api {post} /user/allocate-now Allocate all attribute points.
* @apiVersion 3.0.0
* @apiName UserAllocateNow
* @apiGroup User
*
* @apiSuccess {Object} data `stats`
*/
api.allocateNow = {
method: 'POST',
middlewares: [authWithHeaders(), cron],
url: '/user/allocate-now',
async handler (req, res) {
let user = res.locals.user;
let allocateNowRes = common.ops.allocateNow(user, req);
await user.save();
res.respond(200, allocateNowRes);
},
};
/**
* @api {post} /user/buy/:key Buy a content item.
* @apiVersion 3.0.0