var Boom = require('boom');
var User = require('../models/User');
var bookshelf = require('../db/bookshelf_init')
var Promise = require('bluebird');
var R = require('ramda');

module.exports = [
  {
    method: 'GET',
    path: '/users/{id}',
    handler: function (req, res) {
      if (!req.params.id) {
        return res(Boom.badRequest('Valid user id required'));
      }
      Promise.all([
        User.where({id: req.params.id}).fetch({withRelated: 'badges'}),
        bookshelf.knex('changesets')
        .select('*')
        .orderBy('created_at', 'desc')
        .where('user_id', req.params.id)
        .limit(1),
        bookshelf.knex('changesets')
        .select('created_at')
        .where('user_id', req.params.id)
      ])
      .then(function (results) {
        var user = results[0];
        var latest = results[1];
        var edit_times = R.map(R.prop('created_at'), results[2]);

        var serialized = user.toJSON();
        serialized.latest = latest;
        serialized.edit_times = edit_times;
        return serialized;
      })
      .then(res);
    }
  }
]
@@ -188,16 +188,301 @@
 rts = %5B%0A
+  %7B%0A    method: 'GET',%0A    path: '/users',%0A    handler: function (req, res) %7B%0A      User.fetchAll(%7Bcolumns: %5B'name'%5D%7D)%0A      .then(function (hashtags) %7B%0A        var serialized = hashtags.toJSON();%0A        return R.map(R.prop('name'), serialized);%0A      %7D)%0A      .then(res)%0A    %7D%0A  %7D,%0A%0A
   %7B%0A    

Add all users route