Merge branch 'TheHollidayInn-api-v3-user-set-last-cron-fix' into api-v3

This commit is contained in:
Blade Barringer
2016-05-20 08:03:47 -05:00
6 changed files with 93 additions and 14 deletions

View File

@@ -1313,4 +1313,31 @@ api.userReset = {
},
};
/**
* @api {post} /api/v3/user/custom-day-start Sets preferences.dayStart for user
* @apiVersion 3.0.0
* @apiName setCustomDayStart
* @apiGroup User
*
* @apiSuccess {Object} data An empty Object
*/
api.setCustomDayStart = {
method: 'POST',
middlewares: [authWithHeaders()],
url: '/user/custom-day-start',
async handler (req, res) {
let user = res.locals.user;
let dayStart = req.body.dayStart;
user.preferences.dayStart = dayStart;
user.lastCron = new Date();
await user.save();
res.respond(200, {
message: res.t('customDayStartHasChanged'),
});
},
};
module.exports = api;