add tests for getChallengeMemberProgress route and several bug fixes

This commit is contained in:
Matteo Pagliazzi
2016-01-17 18:31:03 +01:00
parent 8de8ca7e18
commit ec7ed9c90e
5 changed files with 184 additions and 59 deletions

View File

@@ -84,10 +84,10 @@ api.createUserTasks = {
*/
api.createChallengeTasks = {
method: 'POST',
url: '/tasks/challenge/:challengeId',
url: '/tasks/challenge/:challengeId', // TODO should be /tasks/challengeS/:challengeId ? plural?
middlewares: [authWithHeaders(), cron],
async handler (req, res) {
req.checkQuery('challengeId', res.t('challengeIdRequired')).notEmpty().isUUID();
req.checkParams('challengeId', res.t('challengeIdRequired')).notEmpty().isUUID();
let reqValidationErrors = req.validationErrors();
if (reqValidationErrors) throw reqValidationErrors;
@@ -188,7 +188,7 @@ api.getChallengeTasks = {
url: '/tasks/challenge/:challengeId',
middlewares: [authWithHeaders(), cron],
async handler (req, res) {
req.checkQuery('challengeId', res.t('challengeIdRequired')).notEmpty().isUUID();
req.checkParams('challengeId', res.t('challengeIdRequired')).notEmpty().isUUID();
req.checkQuery('type', res.t('invalidTaskType')).optional().isIn(Tasks.tasksTypes);
let validationErrors = req.validationErrors();