port locals middleware, add some tests and a lot of fixes

This commit is contained in:
Matteo Pagliazzi
2016-02-19 18:42:03 +01:00
parent feadfbcd9e
commit cc31d266e4
18 changed files with 158 additions and 18 deletions
@@ -14,6 +14,7 @@ import AWS from 'aws-sdk';
import nconf from 'nconf';
import got from 'got';
import Q from 'q';
import locals from '../../middlewares/api-v3/locals';
let S3 = new AWS.S3({
accessKeyId: nconf.get('S3:accessKeyId'),
@@ -25,6 +26,8 @@ const BASE_URL = nconf.get('BASE_URL');
let api = {};
// TODO move these routes out of the /api/v3/export namespace to the top level /export
/**
* @api {get} /export/history.csv Export user tasks history in CSV format. History is only available for habits and dailys so todos and rewards won't be included
* @apiVersion 3.0.0
@@ -152,6 +155,7 @@ api.exportUserDataXml = {
api.exportUserAvatarHtml = {
method: 'GET',
url: '/export/avatar-:memberId.html',
middlewares: [locals],
async handler (req, res) {
req.checkParams('memberId', res.t('memberIdRequired')).notEmpty().isUUID();