mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
@@ -1311,26 +1311,29 @@ api.userReset = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/user/set-custom-day-start Sets preferences.dayStart for user
|
||||
* @api {post} /api/v3/user/custom-day-start Sets preferences.dayStart for user
|
||||
* @apiVersion 3.0.0
|
||||
* @apiName UserSetCustomDayStart
|
||||
* @apiName setCustomDayStart
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiSuccess {Object} data An empty Object
|
||||
*/
|
||||
api.userSetCustomDayStart = {
|
||||
api.setCustomDayStart = {
|
||||
method: 'POST',
|
||||
middlewares: [authWithHeaders()],
|
||||
url: '/user/set-custom-day-start',
|
||||
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, {});
|
||||
res.respond(200, {
|
||||
message: res.t('customDayStartHasChanged'),
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user