User auth performance improvements (#9589)

* Added initial user projecting in auth and fixed projection for get user tasks

* Added fields to score route

* Added another field to get tasks

* Added group fields to user
This commit is contained in:
Keith Holliday
2017-11-30 08:17:28 -06:00
committed by GitHub
parent 77f71b5415
commit a097819b72
2 changed files with 11 additions and 5 deletions

View File

@@ -262,7 +262,7 @@ api.createChallengeTasks = {
api.getUserTasks = {
method: 'GET',
url: '/tasks/user',
middlewares: [authWithHeaders()],
middlewares: [authWithHeaders(false, '_id preferences tasksOrder')],
async handler (req, res) {
let types = Tasks.tasksTypes.map(type => `${type}s`);
types.push('completedTodos', '_allCompletedTodos'); // _allCompletedTodos is currently in BETA and is likely to be removed in future
@@ -517,7 +517,7 @@ api.updateTask = {
api.scoreTask = {
method: 'POST',
url: '/tasks/:taskId/score/:direction',
middlewares: [authWithHeaders()],
middlewares: [authWithHeaders(false, '_id stats profile preferences tasksOrder _ABtests webhooks party guilds')],
async handler (req, res) {
req.checkParams('direction', res.t('directionUpDown')).notEmpty().isIn(['up', 'down']);